learning_brain
New Member
- Messages
- 206
- Reaction score
- 1
- Points
- 0
Hope you can help on this.
I have a short script to produce a thumb from an image url and then save it to my thumbs directory.
$image_url and $image_id are pulled from a recordset.
I think the script works (and have tested it with the jpg header) but when trying to save, I get ...
Warning: imagejpeg() [function.imagejpeg]: Unable to open 'thumbs/33595.jpg' for writing: Permission denied in /home/a3804641/public_html/test2.php on line 45
I have checked the permissions on the thumbs folder, which are "rwxr-xr-x"
Why am I getting this error message?
I have a short script to produce a thumb from an image url and then save it to my thumbs directory.
PHP:
//set max size for thumb
$max_width=110;
$max_height=80;
//header('Content-type: image/jpeg');
// Setting the resize parameters
list($width, $height) = getimagesize($image_url);
$ratio = $width/$height;
if($width>$height){
$modwidth = $max_width;
$modheight = $max_height / $ratio;
} else {
$modheight = $max_height;
$modwidth = $max_width / $ratio;
}
// Resizing the Image
$tn = imagecreatetruecolor($modwidth, $modheight);
$image = imagecreatefromjpeg($image_url);
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height);
//imagejpeg($tn, null, 60);
$save = 'thumbs/'.$image_id.'.jpg';
imagejpeg($tn, $save, 60) ;
$image_url and $image_id are pulled from a recordset.
I think the script works (and have tested it with the jpg header) but when trying to save, I get ...
Warning: imagejpeg() [function.imagejpeg]: Unable to open 'thumbs/33595.jpg' for writing: Permission denied in /home/a3804641/public_html/test2.php on line 45
I have checked the permissions on the thumbs folder, which are "rwxr-xr-x"
Why am I getting this error message?