Hello,
i have the following code:
[syntax=php]$image = imagecreatefromjpeg($url.'/'.$file);
$filename = explode('.',$file);
$imagesx = imagesx($image)/2;
$imagesy = imagesy($image)/2;
$thumbnail = imagecreate(100,100);
imagecopyresized($thumbnail,$image,0,0,$imagesx/2,$imagesy/2,100,100,100,100);
imagejpeg($thumbnail,$filename[0].'_alt.'.$filename[1],50);
imagedestroy($thumbnail);[/syntax]
on script debuggin i get a [quote]imagejpeg: unable to open 'band_image0_alt.jpg' for writing[/quote]
im am unsure as to what are the paramters to be for the imagejpeg() the documentation isnt specific what should be the paramaters?
Kendall
imagejpeg() unable to write to file error
Moderator: General Moderators
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
AVATAr,
Yeah man i guess as the directory was newly created...the process is as follows :-
user creates a folder
user uploads file to folder
thumbnail is suppose to be created from file
note: directories are created umask(0); then mask(0777);
note: files were successfully uploaded even though no thumbs were created
note: thumnails files are renamed with an '_alt'
is file directory permissions the only reason why? what other reasons can there be
Kendall
Yeah man i guess as the directory was newly created...the process is as follows :-
user creates a folder
user uploads file to folder
thumbnail is suppose to be created from file
note: directories are created umask(0); then mask(0777);
note: files were successfully uploaded even though no thumbs were created
note: thumnails files are renamed with an '_alt'
is file directory permissions the only reason why? what other reasons can there be
Kendall
-
pootergeist
- Forum Contributor
- Posts: 273
- Joined: Thu Feb 27, 2003 7:22 am
- Location: UK
if they create a directory, surely the save path of the thumbnail should include that directory name?
imagejpeg($thumbnail, $url. '/' .$filename[0]. '_alt.' .$filename[1], 80);
note: upped the 50 quality to 80 (at a compression setting of 50 you are going to get pretty nasty looking thumbs)
Also, if you are using GD2+ you should use imagecreatetruecolor and imagecopyresized to assure a palette greater than 256 indices.
Last note: If you are using GD2+ you could try the thumbnailing class from here - which would simplify the calls and assure proportional thumbnails within a bounding limit box. Can also add bevel, drop shadow, motion blur, greyscale etc etc
imagejpeg($thumbnail, $url. '/' .$filename[0]. '_alt.' .$filename[1], 80);
note: upped the 50 quality to 80 (at a compression setting of 50 you are going to get pretty nasty looking thumbs)
Also, if you are using GD2+ you should use imagecreatetruecolor and imagecopyresized to assure a palette greater than 256 indices.
Last note: If you are using GD2+ you could try the thumbnailing class from here - which would simplify the calls and assure proportional thumbnails within a bounding limit box. Can also add bevel, drop shadow, motion blur, greyscale etc etc
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
pootergeist,
why yes of course as it is the same path used to save the file (for a moment i was trying it url based thinking that was the problem) but tell me does it need the absolute path?
i acknowlgede you advice concerning the GD2+ i will look into it and c didnt no dat existed
doubt i have it (backward hosting)
Kendall
why yes of course as it is the same path used to save the file (for a moment i was trying it url based thinking that was the problem) but tell me does it need the absolute path?
i acknowlgede you advice concerning the GD2+ i will look into it and c didnt no dat existed
doubt i have it (backward hosting)
Kendall