The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Wide image automatic resize for html and vB tags in posts - fixes template problems Details »» | |||||||||||||||||||||||||||
Wide image automatic resize for html and vB tags in posts - fixes template problems
Developer Last Online: Mar 2013
Having trouble with large images in [img] or <img src> tags in your posts causing your templates to go too wide causing a horizontal scroll bar for all posts? I have many users that attach large images to their posts either through vB img or html img src tags. In vB2 it wasn't that much of an issue because it only caused their post to go wide causing a horizontal scroll bar. In vB3 it causes all the posts on that thread to go to that width.
This hack uses the img src width="xx" tag to resize the picture to whatever max size you wish. It also adds a link to the full size image in it's original location and retains any extra formatting the user puts in the tag. In addition it checks to see if the picture actually exists and if not show "Image link is broken" where the picture would have been. Please click install if you install it and please give feedback so I can go full release with it if it's bug free. Updated on 07/30/2004 - R0.9 Updated on 08/06/2004 - R1.0 - Identical to R.9, no need to upgrade just changing to full release from beta Updated on 08/10/2004 - R1.1 - Added max_imgsize to the 2nd section of code (and removed global max_imgsize line from both), some users had problems with the code grabbing the max_imgsize from the first section - this fixes that. Updated on 09/09/2004 - R1.2 - fixed problem with duplicating the resize notice when using wysiwyg editor Show Your Support
|
Comments |
#22
|
|||
|
|||
It looks like cinq's image problem is a bug in the version of php he's running. I linked to the same images on our site and they worked fine. We are running php v4.2.1 . Not sure yet what he's running.
|
#23
|
|||
|
|||
I'm running PHP 4.2.3 and it only works on some images, not all of them.
Like here this thread But it did work on an image in this thread |
#24
|
|||
|
|||
Jolten - That picture is an attachment, it's not using vB IMG or html IMG SRC tags. You can limit the size of attachments through the vbulletin setting in your admin control panel. This hack deals with images that are linked from other servers via tags.
|
#25
|
|||
|
|||
ahh. okay.. Sorry My bad. So the reduce image only works for directly linked images. Great! Thanks Steve.
|
#26
|
|||
|
|||
Okay, its really finde , i installed it.
I would like to do a change: How can i change it to target=_blank? Thank you. |
#27
|
|||
|
|||
You would add it into these lines:
in the first part: $bbtag = '<table><tr><td align="center"><a href="' . $link . '"><img src="' . $link . '" width="'.$max_imgsize.'" border="0"'.substr($bbtag,$linkclose+1,strlen($bbt ag)-$linkclose+1).'<br>Picture has been resized, click for full size pic</a></td></tr></table>'; would become: $bbtag = '<table><tr><td align="center"><a href="' . $link . '" target="_blank"><img src="' . $link . '" width="'.$max_imgsize.'" border="0"'.substr($bbtag,$linkclose+1,strlen($bbt ag)-$linkclose+1).'<br>Picture has been resized, click for full size pic</a></td></tr></table>'; and in the second section: $biglink = '<table><tr><td align="center"><a href="' . $link . '" ><img src="' . $link . '" width="'.$max_imgsize.'" border="0" alt=""><br>Picture has been resized, click for full size pic</a></td></tr></table>'; would become: $biglink = '<table><tr><td align="center"><a href="' . $link . '" target="_blank"><img src="' . $link . '" width="'.$max_imgsize.'" border="0" alt=""><br>Picture has been resized, click for full size pic</a></td></tr></table>'; |
#28
|
|||
|
|||
Thank you very much. Done.
|
#29
|
|||
|
|||
Excellent, I only had one snag. I had to add
Code:
$max_imgsize=560; |
#30
|
|||
|
|||
I hve somme Error
Fatal error: Call to undefined function: handle_bbcode_img_match() in /var/www/web1/html/vb3/includes/functions_bbcodeparse.php(1085) : regexp code on line 1 do i have the comlete Line Code:
function handle_bbcode_img_match($link) { $link = strip_smilies(str_replace('\\"', '"', $link)); // remove double spaces -- fixes issues with wordwrap $link = str_replace(' ', '', $link); Code:
// Image Size hack r1.0 // Modified by SS to resize large pics and place link to full size pic // return '<img src="' . $link . '" border="0" alt="" />'; global $max_imgsize; $image= ($link); // Get host url name for fsockopen to see if server is reachable $img_host=str_replace('http://','',$link); $img_host=substr($img_host,0,strpos($img_host,'/')); // Check is server is reachable and timeout in 5 seconds if not if (@fclose(@fsockopen($img_host, 80, $fsockerr1, $fsockerr2, 5))) { // Check if image is on server if (@fclose(@fopen("$image", "r"))) { // Check image size and if oversize, change link $img_width = getimagesize($link); if ($img_width[0] > $max_imgsize) { $biglink = '<table><tr><td align="center"><a href="' . $link . '" ><img src="' . $link . '" width="'.$max_imgsize.'" border="0" alt=""><br>Picture has been resized, click for full size pic</a></td></tr></table>'; return $biglink; } else { return '<img src="' . $link . '" border="0" alt="" />'; } } else { // Image not found return '<table border="1" cellpadding="2"><tr><td><FONT color="#FF0000">Image link is broken</font></td></tr></table>'; } } else { // Server is down return '<table border="1" cellpadding="2"><tr><td><FONT color="#FF0000">Image server is down</font></td></tr></table>'; } // End Image Size hack r1.0 |
#31
|
|||
|
|||
Only replace the return line with that code - not all the lines you've shown. It is the very next line after those that you are replacing. I have that line commented out in the beginning of the hack so that you can roll back to it if you want to down the road. This is the line:
return '<img src="' . $link . '" border="0" alt="" />'; I've just updated this, btw - please use the new code. I only changed 3 lines due to problem a couple people had. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|