Resize image without GD by ratio

function ResizeRatioWidth($imagewidth, $imageheight, $maxwidth) {
if($imagewidth>$maxwidth) {
$ratio = $maxwidth / $imagewidth;
$newheight = $imageheight * $ratio;
return ‘ width=”‘.$maxwidth.'” height=”‘.$newheight.'”‘;
} else {
return ‘ width=”‘.$imagewidth.'” height=”‘.$imageheight.'”‘;
}
}

$url = “http://t0.gstatic.com/images?q=tbn:e5EUAhqp3oOquM%3Ahttp://www.ansteorrastables.com/images/istock_000003402252medium_1cqc.jpg”;
$imageinfo = getimagesize($url);
echo ‘<img src=”‘.$url.'” border=0 alt=””><br><br><img src=”‘.$url.'” border=0 alt=”” ‘.ResizeRatioWidth($imageinfo[0],$imageinfo[1],100).’>’;

About selvam4win

I am Selvam. I am very jolly person and frank one.

Posted on January 19, 2010, in Uncategorized and tagged , , . Bookmark the permalink. 1 Comment.

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

%d bloggers like this: