this script, made by me, lets you resize an image propotionally!
Resizing an image
<?php
//visit www.corehackers.com , a security portal
$image = $HTTP_GET_VARS['image'];
if (!max_width)
$max_width = 80;
if (!max_height)
$max_height = 60;
$size = GetImageSize($image);
$width = $size[0];
$height = $size[1];
$x_ratio = $max_width / $width;
$y_ratio = $max_height / $height;
if (($height <= $max_height) && ($width <= $max_width))
{
$tn_height = $height;
$tn_width = $width;
}
elseif (($x_ratio * $height) < $max_height)
{
$tn_height = ceil($x_ratio * $height);
$tn_width = $max_width;
}
else {
$tn_width = ceil($y_ratio * $width);
$tn_height = $max_height;
}
$src = ImageCreateFromJpeg($image);
$dst = ImageCreate($tn_width,$tn_height);
ImageCreateResized($dst, $src, 0, 0, 0, 0, $tn_width, $tn_height, $width, $height);
header('Content-type: image/jpeg');
ImageJpeg($dst, null, -1);
ImageDestroy($src);
ImageDestroy($dst);
//by firstbase/corewizard from www.corehackers.com
?>
72dpi 11 Newbie Poster
vanceibz 0 Newbie Poster
mohamed badr 0 Newbie Poster
willjames 0 Newbie Poster
franx47 0 Newbie Poster
chumsie 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.