Is there any way around this php problem involving imagejpeg()?
I'm working on a form that uploads a file to a folder using PHP 5. When it uploads, I'm trying to create a resized version of the image using imagecopyresampled. Then I try to use imagejpeg() to save the resized image to a seperate folder.
It throws up this error...
Unable to open 'Y' for writing: Is a directory in Y
I've googled around, and CHMODed the folder to 777, but I still can't put an end to this error.
Is there some workaround I could try? If I can't save it to a folder, can I try to insert it into a table in MySQL?
In the worst case scenario, I can dynamically resize the images for the page I want to create, but that seems like it would put far too much strain on the server.
Here's the chunk of code I'm using
$thisimage = # information pulled from higher up in the file
$dir = "./images/smaller/"; #according to 2 different ftp programs, this directory should be writable
$quality = 60;
$image_location = "./images/";
$image_location .= $thisimage;
$src = ImageCreateFromJPEG("$image_location");
$width =ImageSx($src);
$height = ImageSy($src);
$x = $width/4;
$y = $height/4;
$dst = ImageCreateTrueColor($x,$y);
imagecopyresampled($dst,$src,0,0,0,0,$x,$y,$width,$height);
imagejpeg($dst,$dir , $quality);
posted by drezdn at 8:24 PM on October 12, 2007