I've been truble shooting this for hours and i've been all over the web trying to find the solution to this... Im writing a thumbnale generater in php that should generate a gray scale image and a non gray scale, but i've been running into this error. I have already changed my permissions to 777 and chown to nobody and admin. and this function works as long as I over write an image by the same name, but it cannot store in a file for some reason.
here is the error:
imagejpeg() [function.imagejpeg]: Unable to open '/Applications/XAMPP/xamppfiles/htdocs/images
/thumb/rollover' for writing: Is a directory
here is the code i'm working with.
$img = imagecreatefromjpeg($grayscale_path);
imagefilter($img, IMG_FILTER_GRAYSCALE);
imagejpeg($img, realpath($this->gallery_path .'/thumb/rollover/'));
imagedestroy($img);
also i've checked many many times to see if the path is correct and it is.
You need to append a filename,
header("Content-type: image/jpeg");
imagejpeg($img, realpath($this->gallery_path .'/thumb/rollover/filename.jpg'));
在imagejpeg中,第二个参数不是目录的路径,而是实际文件的路径,必须在路径末尾添加“ filename.jpg”。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.