Suggestion: Image resizing

1 pages Page 1
Djinn Effer
Djinn Effer
Frost Gate Guardian
#1
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

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

I
Inde
Site Contributor
#2
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
Savio
Teenager with attitude
#3
Good, cause I'm tired of resizing everything myself.
Djinn Effer
Djinn Effer
Frost Gate Guardian
#4
You could try something like this, though it hasn't been updated in ages, it seems. ^^
Amity and Truth
Amity and Truth
Jungle Guide
#5
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.

Code:
<?
/* 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>";
}
?>