sometimes it will just trim photo down really skinny. but when i refresh it works fine. i dont get it? i hit properties when the image is skinny and it looks normal. heres the image resize code im using. see photos.
http://www.elac.net/temp/phphelp.gif - properties window
http://www.elac.net/temp/phphelp3.jpg - works fine
http://www.elac.net/temp/phphelp2.jpg - screwed up
<?php
if (substr($filename , 1) != "/") {
$filename = "/" . $filename;
}
$i_filename = "/data/sites/113366/stovesdirect.com/www" . $filename;
$i_w = $width;
$i_h = $height;
$image_info = getImageSize($i_filename);
//Determine the new width and height for the image
$image_old_type = $image_info[2];
$image_old_w = $image_info[0];
$image_old_h = $image_info[1];
if (($image_old_h > $i_h) || ($image_old_w > $i_w))
{
$d_h = $i_h / $image_old_h;
$d_w = $i_w / $image_old_w;
if ($d_h < $d_w)
{
$d_c = $d_h;
}
else
{
$d_c = $d_w;
}
}
else
{
$d_c = 1;
}
$image_new_h = $image_old_h * $d_c;
$image_new_w = $image_old_w * $d_c;
//Load Image
switch ($image_old_type)
{
case 1:
$content_type = "image/gif";
//we cannot modify a gif image.
break;
case 2:
$content_type = "image/jpeg";
$image_old_handle = imageCreateFromJPEG($i_filename);
break;
case 3:
$content_type = "image/png";
$image_old_handle = imageCreateFromPNG($i_filename);
break;
default:
$content_type = "image";
//we cannot modify an unknown image.
}
if (($image_old_type == 2) || ($image_old_type == 3))
{
$image_new_handle = imageCreateTrueColor($image_new_w, $image_new_h);
imageCopyResampled($image_new_handle, $image_old_handle, 0, 0, 0, 0, $image_new_w, $image_new_h, $image_old_w, $image_old_h);
header("Content-Type: $content_type");
imageJPEG($image_new_handle);
}
else
{
header("Content-Type: $content_type");
include($i_filename);
}
?>