hi ,
i have a script to resize image, it works on normal jpg file which taken by normal camera, but when come to image that took by DSLR camera, it fail to resize.
i had debug the code, it fail when script "imagecreatefromjpeg"
my code as below:
function resizeImage($img, $imgPath, $suffix, $by, $quality)
{
// Open the original image.
[COLOR="Red"]$original = imagecreatefromjpeg("$imgPath/$img") or die("Error Opening original (<em>$imgPath/$img</em>)");[/COLOR]
list($width, $height, $type, $attr) = getimagesize("$imgPath/$img");
// Determine new width and height.
$newWidth = ($width/$by);
$newHeight = ($height/$by);
// Resample the image.
$tempImg = imagecreatetruecolor($newWidth, $newHeight) or die("Cant create temp image");
imagecopyresized($tempImg, $original, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height) or die("Cant resize copy");
// Create the new file name.
$newNameE = explode(".", $img);
//$newName = ''. $newNameE[0] .''. $suffix .'.'. $newNameE[1] .'';
//$newName = $impath . "/" . $img . "." . $newNameE[1] ;
$newName = $impath . "/" . $img ;
// Save the image.
imagejpeg($tempImg, "$imgPath/$newName", $quality) or die("Cant save image");
// Clean up.
imagedestroy($original);
imagedestroy($tempImg);
return true;
}
Please help to see what is going wrong.
thank you in advance