Web Hosting Talk







View Full Version : Saving jpeg using PHP


herrien11
10-09-2004, 10:48 AM
I am trying to generate jpeg images using PHP and would like to save the output of the php in jpeg format as in,

picture.php --> to save it in the same directory as picture.jpeg

That means saving imagejpeg($image); as jpeg?

Is it possible?

Thanks in advance :)

christowang
10-09-2004, 12:10 PM
http://us2.php.net/imagejpeg

bool imagejpeg ( resource image [, string filename [, int quality]])


so you can just do imagejpeg($image, "picture.jpeg");

herrien11
10-10-2004, 10:26 AM
Thanks man, hehe it seems so straight forward, yet i did not manage to solve it :)

xelav
10-11-2004, 03:20 PM
can you tell, what errors do you get?

herrien11
10-12-2004, 07:00 AM
i did not get any error, only that I cannot manage to save the jpeg image.

thartdyke
10-12-2004, 10:38 AM
Have you used an explicit pathname with the filename? I've had problems in the past juts trying to save to the current directory.

christowang
10-12-2004, 11:06 AM
Originally posted by herrien11
i did not get any error, only that I cannot manage to save the jpeg image.

Check the permissions for the directory you are trying to save in. If you are running php as a mod to a apache, you may be having problems.

To test it, set the directory you want to save the images too as 777 to see if that's the problem. Then you can set it to something more secure from there.

herrien11
10-12-2004, 11:26 AM
so you mean setting it to 777 can secure the folder, sorry i am not too sure about apache server.

Promethyl
10-13-2004, 01:16 PM
777 is full rights, meaning anyone can change your files... check via FTP if you do not have or understand SSH Telnet.

herrien11
10-13-2004, 01:34 PM
ok thank you very much.

pavstadotcom
10-14-2004, 02:48 PM
if you cant change the rights using ur ftp try using WS_FTP

BattleForce
10-14-2004, 05:28 PM
smartFTP is better imo