No Thumbs and Images?

Phoca Gallery - image gallery extension
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49297
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Yes, you right, the

Post by Jan »

Yes, you right, the thumb should be 644, but I have no idea why you get 600... the thumbs are created by GD library functions, maybe there is some settings... maybe there is some server settings which set all new created files on the server to 600 ???

Jan
If you find Phoca extensions useful, please support the project
Joosttt
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 27 Apr 2009, 20:58

Re: No Thumbs and Images?

Post by Joosttt »

Hi,
I'm having the same problem with my newly installed Phoca Gallery. Only my thumbs are set to 660 where they should be 664 or 644. When I do this manually on my server there's no problem. But I would really like to have this done automatically.

I searched for ways to set the default permissions for newly created files. Seems like Umask has something to do with default permissions. But I don't have access to the server of my webhosting.

Anyone any hints how to solve this problem?

** EDIT **

I found out that there is a function 'umask' in php with whom you can set the umask. This way it could be possible to set the umask to 022 (and that way get 644 permissions on the files). I would like to try to implement this, but i need to know in what file of phoca gallery the thumbnails are created. Could someone point me in the right direction?


My installation:
Server: apache (version?)
PHP Version 5.2.6
Joomla 1.5.10
Phoca Gallery v2.2.3
GD Version: bundled (2.0.34 compatible)
Joosttt
Phoca Newbie
Phoca Newbie
Posts: 2
Joined: 27 Apr 2009, 20:58

Re: No Thumbs and Images?

Post by Joosttt »

Ok, finally solved this problem with a dirty hack.
After some research I found out that the php function umask is used to set default permissions for created files. What I did is set the mask to 0022 (this gives a default 644 permission) in the following file:
/administrator/components/com_phocagallery/helpers/phocagallery.php

Just below the lines

Code: Select all

	function rotateImage($thumbName, $size, $angle=90) {
and

Code: Select all

	function getOrCreateThumbnail($orig_path, $file_no, $refresh_url, $small=0, $medium=0,$large=0,$frontUpload=0) {
I wrote

Code: Select all

umask(0022);
This sets the default permission to 644 and solves my problem. I'm quite sure that this won't solve the whole problem with default permissions because I didn't look through every peace of code where files are written. But it solves my problem for now.

Would be cool if this could more neatly be implemented as a new feature.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 49297
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: No Thumbs and Images?

Post by Jan »

Ok... the problem of permissions is, it should not be set in PHP but on server, so php code should not work with permissions and ownership :-(

Jan
If you find Phoca extensions useful, please support the project
Post Reply