Hello people,
I am creating thumbnails from images that get uploaded when a user submits.
The thumb is created and stored onto the server in the proper location, BUT when I go in to edit or change an image, the original image gets overwritten when a new image is uploaded, but the new thumb doesn't overwirte the old thumb. It's gives out this error:
Warning: imagejpeg() [function.imagejpeg]: Unable to open '/mydirectory/thumbs/110.jpg' for writing in /mydirectory/title_adder.php on line 62
All directories are chmod'd correctly. I can't figure it out. Any help is appreciated. here's the part of my script that creates the thumbnails:
//if a file was uploaded
$file_name = "$ID.jpg";
if( @copy($file, "/mydirectory/$file_name") )
{
$iname="$file";
$x=60;
$y=89;
$srcimage = ImageCreateFromJPEG ($iname);
$newimage = imagecreatetruecolor ($x, $y);
imagecopyresized ($newimage, $srcimage, 0, 0, 0, 0, $x, $y, imagesx($srcimage), imagesy($srcimage));
imagejpeg($newimage,"/mydirectory/thumbs/$ID.jpg",100);
//delete the temporary uploaded image
unlink($file);
}