davehaz
04-18-2006, 06:33 PM
howdy,
I have written a little script to resize images it really slows the page down when loading. Would you experts please take a look at it and let me know if there is anyway to speed it up?
$src=$IMAGEURL;
$typepos = strrpos($src,".");
$typepos++;
$type = substr($src,$typepos);
if($type == 'jpeg'){$src_img=imagecreatefromjpeg($src);}
elseif($type == 'jpg'){$src_img=imagecreatefromjpeg($src);}
elseif($type == 'gif'){$src_img=imagecreatefromgif($src);}
$old_x=imagesx($src_img);
$old_y=imagesy($src_img);
if ($old_x > '150')
{
$thumb_w=$old_x*(150/$old_x);
$thumb_y=$old_y*(150/$old_y);
$width = $thumb_w;
$height = $thumb_y;
}
elseif (($old_x == $old_y) & ($old_x > 150))
{
$width = 150;
$height = 150;
}
elseif ($old_x < '150')
{
$width=$old_x;
$height=$old_y;
}
tia.
I have written a little script to resize images it really slows the page down when loading. Would you experts please take a look at it and let me know if there is anyway to speed it up?
$src=$IMAGEURL;
$typepos = strrpos($src,".");
$typepos++;
$type = substr($src,$typepos);
if($type == 'jpeg'){$src_img=imagecreatefromjpeg($src);}
elseif($type == 'jpg'){$src_img=imagecreatefromjpeg($src);}
elseif($type == 'gif'){$src_img=imagecreatefromgif($src);}
$old_x=imagesx($src_img);
$old_y=imagesy($src_img);
if ($old_x > '150')
{
$thumb_w=$old_x*(150/$old_x);
$thumb_y=$old_y*(150/$old_y);
$width = $thumb_w;
$height = $thumb_y;
}
elseif (($old_x == $old_y) & ($old_x > 150))
{
$width = 150;
$height = 150;
}
elseif ($old_x < '150')
{
$width=$old_x;
$height=$old_y;
}
tia.