View Full Version : Show Thread Enhancements - The most simple image resizer
Frosty
08-05-2011, 10:00 PM
If you're sick of all those JS based image resizers, you can use this simple code modification to resize high resolution images everywhere.
Go to: /includes/class_bbcode.php (Line 1987)
Find:
return '<img src="' . $link . '" border="0" alt="" />';
Replace with:
return '<img src="' . $link . '" border="0" alt="" style="max-width: 700px" />';
Depending on your post table width, you might change "700px" to some other value, e.g. "800px". It will only resize images that are wider than 700px, which will make them fit to the post table.
There are no other edits required, if user wants to see the full image he'll have to go right click and then view image. Which is in my opinion way better than that fancy "Click to see it in full resolution".
Simple but effective! :D
BirdOPrey5
08-07-2011, 11:24 AM
Very interesting simple edit... :up:
If you changed it to this:
return '<a href="'. $link .'"><img src="' . $link . '" border="0" alt="" style="max-width: 700px" /></a>';
That would make each image a link to the full size image, like here on vbulletin.org.
Frosty
08-08-2011, 06:19 AM
Yup, that's also good. Even though you could add target="_blank" to open in a new window, to make it easier if there are many images in the thread.
zekiturk
08-12-2011, 12:01 PM
hoe can we doing " alt="thema title" "
el-q6ri
08-17-2011, 08:22 PM
hi thanks for the mode
I use it like this
return '<a target="_blank" href="'. $link .'"><img src="' . $link . '" border="0" alt="" style="max-width: 700px" /></a>';
but the problem
if the image is has a link for a post or any url it will not lead to the link I want to for example
https://vborg.vbsupport.ru/external/2011/08/49.png (http://www.souqaldoha.com)
A.Chakery
12-25-2011, 02:24 AM
Ist here any way to set an if for the image size ?
I mean if the image size was bigger than 600px it makes it like this
return '<a href="'. $link .'"><img src="' . $link . '" border="0" alt="" style="max-width: 600px" /></a>';
but if it was smaller than 600px it makes it like this one :
return '<img src="' . $link . '" border="0" alt="" style="max-width: 600px" />';
??
any help is really appreciated ...
BirdOPrey5
12-25-2011, 05:13 PM
Yes and no...
You could test for it but it would require custom php code and you would need to download a copy of every image, at least temporarily, to you server so you could read the size- this would be a relatively slow process but possible, yes.
A.Chakery
12-25-2011, 06:06 PM
thanks for the reply,
got it, so I think I am gonna leave it for now :)
Max Taxable
12-25-2011, 06:19 PM
Simple and elegant solution. The BOP5 boost to it really helps too.
A.Chakery
12-25-2011, 06:24 PM
unfortunately if I add <a href="'. $link .'"> before the image links in class_bbcode.php, all of images will be linked to themselves so they won't accept URLs anymore.Its a big problem for my website.
valdet
01-12-2012, 01:54 PM
Needless to say that if you just add a simple text like Image: on top of embedded images, you will prevent invisible/transparent images, used as links.
return 'Image:<br /><img src="' . $link . '" border="0" alt="" />';
We had an interesting situation where one spammer was inserting 1x1 px. images and linking them to his site.
With that single code hack, I was able to find in which posts he dropped his link, clear them off and ban him instantly.
Fivestones
04-10-2012, 05:42 PM
i added it and works great thanks ...
blind-eddie
04-10-2012, 11:49 PM
Nice edit...Thanks
RFViet
08-11-2012, 01:42 AM
thank you :D
tehPARADOX
08-13-2012, 10:35 PM
Thanks, might ditch the other mod with bloated features.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.