Warning: imagejpeg(): Unable to open
HELP!!! Please
I cannot figure out what is causing this, obviously. I have a file that I upload and rename, this works fine but when I try to duplicate it and make a thumbnail is where the problem lies, from what I've read it seems like a permissions issue. I have double checked and the images_products_thumbs is set to full permissions. Is this error being caused because it's trying to write to where the php file is stored?
Warning: imagejpeg(): Unable to open 'c:/sites/sitefolder/images_products_thumbs/prod_tn_6.jpg'
for writing in c:sites\components\sitefolder\edit_images.php on line 58
$image_tempname = $_FILES['image_filename']['name'];
$ImageDir = "c:sites/sitefolder/images_products/";
$ImageName = $ImageDir . $image_tempname;
if (move_uploaded_file($_FILES['image_filename']['tmp_name'], $ImageName)) {
list($width, $height, $type, $attr) = getimagesize($ImageName);
switch($type) {
case 2:
$ext = ".jpg";
break;
case 3:
$ext = ".png";
break;
default:
$vProd_Image = False;
$strError = "The image you uploaded was not in the correct format. The only formats acceptable are JPG or PNG.";
unlink($ImageName);
}
echo $ext . "--ext<BR><BR>";
if (!isset($strError)) {
$filenameforDB = "prod_" . $strModifyID . $ext;
$newfilename = $ImageDir . "prod_" . $strModifyID . $ext;
rename($ImageName, $newfilename);
$ImageThumb = "c:sites/sitefolder/images_products_thumbs/";
$newthumbname = $ImageThumb . "prod_tn_" . $strModifyID . $ext;
$newThmb_W = $width * 0.20;
$newThmb_H = $height * 0.20;
switch($type) {
case 2:
$src_img=imagecreatefromjpeg($newfilename);
echo "--creating from jpeg<BR>";
break;
case 3:
$src_img=imagecreatefrompng($newfilename);
echo "--creating from png<BR>";
break;
}
$dst_img=ImageCreateTrueColor($newThmb_W,$newThmb_ H);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $newThmb_W, $newThmb_H, $width, $height);
switch($type) {
case 2:
imagejpeg($dst_img, $newthumbname);
break;
case 3:
imagepng($dst_img, $newthumbname);
break;
}
imagedestroy($dst_img);
imagedestroy($src_img);
}
Thanks
Mike
__________________
Peace
Mike
http://www.eclecticpixel.com
|