See My Simple Image Thumbnailer

June 30, 2007 § Leave a comment

Last week when I noticed the MYRUET members could not upload proper sized image to their profile page, I prepared a simple image thumbnailer. I donno if it helped them a lot but I noticed few members used it. Here is the demo:

http://www.rupom.com/myruet/

It is very simple one to prepare. It manipulates the would-be scale size using this formula:

——————————————————–

function imageScale($image, $newWidth, $newHeight)
{

if(!$size = @getimagesize($image))
{
die("Unable to get info on image $image");
}

$ratio = ($size[0] / $size[1]);

if($newWidth == -1)
{
$ret[1] = $newHeight;
$ret[0] = round(($newHeight * $ratio));
}
else if($newHeight == -1)
{
$ret[0] = $newWidth;
$ret[1] = round(($newWidth / $ratio));

}
else
{
die("Scale Error");
}

return $ret;
}

—————————————————

Please check the thumbnailer and let me know if some changes can make this more strong.

Best regards.

Rupom

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading See My Simple Image Thumbnailer at Rupom Here.

meta

%d bloggers like this: