dnbhead22 Posted April 30, 2012 Share Posted April 30, 2012 Warning: imagejpeg() [function.imagejpeg]: Unable to open '/Applications/XAMPP/xamppfiles/htdocs/images/category/90f9f5fb6bd92875b85a69ed2f5749cc.jpg' for writing: Permission denied in /Applications/XAMPP/xamppfiles/htdocs/admin/library/functions.php on line 254 getting this error when i try to upload a photo using my admin section of a shopping cart. cant figure it out. any help greatly appreciated. heres my code: function copyImage($srcFile, $destFile, $w, $h, $quality = 75) { $tmpSrc = pathinfo(strtolower($srcFile)); $tmpDest = pathinfo(strtolower($destFile)); $size = getimagesize($srcFile); if ($tmpDest['extension'] == "gif" || $tmpDest['extension'] == "jpg") { $destFile = substr_replace($destFile, 'jpg', -3); $dest = imagecreatetruecolor($w, $h); imageantialias($dest, TRUE); } elseif ($tmpDest['extension'] == "png") { $dest = imagecreatetruecolor($w, $h); imageantialias($dest, TRUE); } else { return false; } switch($size[2]) { case 1: //GIF $src = imagecreatefromgif($srcFile); break; case 2: //JPEG $src = imagecreatefromjpeg($srcFile); break; case 3: //PNG $src = imagecreatefrompng($srcFile); break; default: return false; break; } imagecopyresampled($dest, $src, 0, 0, 0, 0, $w, $h, $size[0], $size[1]); switch($size[2]) { case 1: case 2: imagejpeg($dest,$destFile, $quality); break; case 3: imagepng($dest,$destFile); } return $destFile; } Quote Link to comment https://forums.phpfreaks.com/topic/261845-issue-with-admin-image-upload/ Share on other sites More sharing options...
dnbhead22 Posted April 30, 2012 Author Share Posted April 30, 2012 line 254 being case 2: imagejpeg($dest,$destFile, $quality); break; Quote Link to comment https://forums.phpfreaks.com/topic/261845-issue-with-admin-image-upload/#findComment-1341763 Share on other sites More sharing options...
Jessica Posted May 1, 2012 Share Posted May 1, 2012 What are the permissions on the folder? Quote Link to comment https://forums.phpfreaks.com/topic/261845-issue-with-admin-image-upload/#findComment-1341999 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.