UPDATE: check latest post (http://www.simplemachines.org/community/index.php?topic=61948.msg456735#msg456735) by me
recently i wrote this into my template..
if (stripos($message['body'], 'photobucket.com/albums') !== false)
$message['body'] = preg_replace('#(<img src=")(http://[^\.]+.photobucket.com/albums/[^\.]+/)((?<!th_)[^\/]+\.(jpg|gif))(\"[^>]*>)#i', '$1$2th_$3" onclick="this.src=\'$2$3\';$5', $message['body']);
the idea is to automatically turn photobucket images into their thumbnail versions, where you can click them to return to normal size.. just as attachments do..
i'm asking if theres a better/faster place to put it, thats not in display.template.php
addition:
what would be the best way to revert the image.. i cant find anything about a defaultSrc just yet
Where do you have it now? Is it functional?
new method.. within /Sources/Display.php
upgraded to work with photobucket, imageshack.us, and myspace photos.. weither posted as thumbnails or not
the lines on top of this code block are to show location within the file
// Do the censor thang.
censorText($message['body']);
censorText($message['subject']);
// Run BBC interpreter on the message.
$message['body'] = parse_bbc($message['body'], $message['smileysEnabled'], $message['ID_MSG']);
// Filter photos to thumbnails
if (stripos($message['body'], '.llnwd.net/') !== false)
$message['body'] = preg_replace('#(<img src=")(http://myspace-[0-9]+[^\/]+.llnwd.net/[^\.]+)(?:_[s|m|l])(\.(png|bmp|jpg|gif))(\"[^>]*>)#i', '$1$2_m$3" style="cursor:pointer;cursor:hand;" onclick="this.src=(this.src==\'$2_l$3\'?\'$2_m$3\':\'$2_l$3\');$5', $message['body']);
if (stripos($message['body'], '.imageshack.us/img') !== false)
$message['body'] = preg_replace('#(<img src=")(http://img[0-9]+.imageshack.us/img[^\.]+)(?:\.th)?(\.(png|bmp|jpg|gif))(\"[^>]*>)#i', '$1$2.th$3" style="cursor:pointer;cursor:hand;" onclick="this.src=(this.src==\'$2$3\'?\'$2.th$3\':\'$2$3\');$5', $message['body']);
if (stripos($message['body'], 'photobucket.com/albums') !== false)
$message['body'] = preg_replace('#(<img src=")(http://[^\.]+.photobucket.com/albums/[^\.]+/)(?:th_)?([^\/]+\.(png|bmp|jpg|gif))(\"[^>]*>)#i', '$1$2th_$3" style="cursor:pointer;cursor:hand;" onclick="this.src=(this.src==\'$2$3\'?\'$2th_$3\':\'$2$3\');$5', $message['body']);
nobody tested this?
i made it apart of my "usual theme edits" smf mod on my own site.. but its small enough that i'd just call it a tip/trick
Quote from: Insane Ninja on January 18, 2006, 08:24:19 PM
nobody tested this?
i made it apart of my "usual theme edits" smf mod on my own site.. but its small enough that i'd just call it a tip/trick
what if somebody didn't make a thumbnail such as imageshack were you don't always get one...
i dont use imageshack.. i had my friend give me the url to a thumb.. i could put in an onerror code to revert it to the origional form
i don't remember were but i saw some were that php can create the thumbnail. could you do that if the thumbnail doesn't exist?
i do plan to tweak it for hard-coded guest permissions such as replacing images with [guests may not view] or similar