Images created with imagejpeg (and similar) are always 600

GD and GD2 are useful libraries for creating graphics on-the-fly. Discuss your PHP GD and GD2 scripts here.

Moderators: onion2k, General Moderators

Post Reply
neo_fox
Forum Newbie
Posts: 3
Joined: Wed May 14, 2008 12:54 am

Images created with imagejpeg (and similar) are always 600

Post by neo_fox »

Hi all,

I noticed that if I create an image using the function imagejpeg/imagepng the permissions of such file are always set to 600.
This is in most cases no problem if the Apache and PHP are running from the same user (Apache) but on several server (CGI ??) this files are no more readable.
All other files created or copied from PHP or Apache are always 644 (standard umask 22 I guess), so why the files created from php-gd having other permissions?
Is there any way to change it?

Kind regards and thanks in advance,
Neo
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Images created with imagejpeg (and similar) are always 600

Post by onion2k »

Use chmod() after you generate the image.
neo_fox
Forum Newbie
Posts: 3
Joined: Wed May 14, 2008 12:54 am

Re: Images created with imagejpeg (and similar) are always 600

Post by neo_fox »

Yes I know that this is the possible solution but I don't like use chmod.
It causing sometimes problems if the server has some security add ons, especially if it is not right configured.
I just wondering why 600 ?
The standard created files under Linux are always 666 and the standard umask is 0022 so the new created file should have 644 and not 600.
Or am I wrong?

Best regards,
Neo
neo_fox
Forum Newbie
Posts: 3
Joined: Wed May 14, 2008 12:54 am

Re: Images created with imagejpeg (and similar) are always 600

Post by neo_fox »

an other question: are the files created from php-gd always sets 600 or it is not normal?
Post Reply