PDA

View Full Version : Suggestion: Image resizing


Djinn Effer
Nov 04, 2006, 11:51 AM
Here's a suggestion I've been thinking of... When a picture is too wide for the forum to properly display, the forum should automatically remove the picture and create a thumbnail of it, with the bbcode then linking the thumbnail to the actual picture.

An example thread of pictures too wide, no offense to the author, can be seen here (http://www.guildwarsguru.com/forum/showthread.php?t=10050618&page=4)

Here's an example of what I'm talking about:

http://i11.tinypic.com/3y2iioo.jpg (http://i12.tinypic.com/2qu6ats.jpg)

Inde
Nov 04, 2006, 12:29 PM
Yeah, something that's been mentioned before. I'll look around Djinn and see what's out there. I know there are some vb hacks for that but I believe I've found something that may work better.

Savio
Nov 04, 2006, 01:17 PM
Good, cause I'm tired of resizing everything myself.

Djinn Effer
Nov 04, 2006, 06:07 PM
You could try something like this (http://www.vbulletin.org/forum/showthread.php?t=34557), though it hasn't been updated in ages, it seems. ^^

Amity and Truth
Nov 05, 2006, 04:34 AM
I wouldn't use a Javascript to do that. It's easier and faster to just use the HTML inherit resize abilities (that's not the finest solution out there but it saves Guru the Bandwith of having to rehost a resized version of the image like it would be with GD/Imagemagick Resizing and the user the hassle to activate javascript).

Maybe try something along these lines here, it's a bit rushed as i'm short on time currently but it should do the job.


<?
/* Configure your maxsize here. The $image variable SHOULD be in the
sourcecode somewhere but i dont know how
vBulletin named it. Just rename it in my function.*/

$img_maxwidth = 635;

// array[0] = width, array[1] = height

$img_size = getimagesize ($image);
if ($img_size[0] >= $img_maxwidth)
{
$perc = $img_maxwidth / $img_size[0];
$img_size_width = round($img_size[0] * $perc);
$img_size_height = round($img_size[1] * $perc);

echo "<img src=$image width=\"$img_size_width\" height=\"$img_size_height\">
<br><a href=$image> Image Resized, click here to view original version</a>";
}

else
{
echo "<img src=$image>";
}
?>