1

Topic: I can see no images

Hello,
I just installed the board with succes, but there's one problem, I can see no images, The board can't find the images, I checked al the filenames and there's nothing wrong with that! what's the problem?

you can see it at www.sellesweb.nl

Re: I can see no images

If you try to look at one of the images directly by entering the URL in the address bar of your browser, you get the message "Forbidden - You don't have permission to access /img/Oxygen_new.png on this server". What I'm guessing is that the permissions are somehow wrong. You have to make sure that the user that is running your webserver has read access to the img directory and all files in it.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

3 (edited by Gribber 2003-08-21 16:13)

Re: I can see no images

I have some problem with avatars, no problem to upload them, the files exist, does have 600 (rw-------) as persmissins, but this is not good for me smile
because im running php as cgi and apache suexec, there is one special user to exec the phpscript, witch makes uploaded files owned by that user (in this case party/hellweb). The problem starts when the apacheserver tryes to access all uploaded images because it run under a different user (nouser/nogroup, httpd/httpd or something like that), it will not have any permissin to access uploaded pictures.

I guess you set all permission when the files are uploaded? Maybe you should set read access to members in group and nouser/nogroup to (644, rw-r--r--)?

Re: I can see no images

Gribber wrote:

I have some problem with avatars, no problem to upload them, the files exist, does have 600 (rw-------) as persmissins, but this is not good for me smile
because im running php as cgi and apache suexec, there is one special user to exec the phpscript, witch makes uploaded files owned by that user (in this case party/hellweb). The problem starts when the apacheserver tryes to access all uploaded images because it run under a different user (nouser/nogroup, httpd/httpd or something like that), it will not have any permissin to access uploaded pictures.

I guess you set all permission when the files are uploaded? Maybe you should set read access to members in group and nouser/nogroup to (644, rw-r--r--)?


Problems solved.

profile.php

            if ($uploaded_file['type'] == 'image/gif')
            {
                $temp = @move_uploaded_file($uploaded_file['tmp_name'], $options['avatars_dir'].'/'.$id.'.gif');
                @chmod($options['avatars_dir'].'/'.$id.'.gif', 0644);
                @unlink($options['avatars_dir'].'/'.$id.'.jpg');
                @unlink($options['avatars_dir'].'/'.$id.'.png');
            }
            else if ($uploaded_file['type'] == 'image/jpeg' || $uploaded_file['type'] == 'image/pjpeg')
            {
                $temp = @move_uploaded_file($uploaded_file['tmp_name'], $options['avatars_dir'].'/'.$id.'.jpg');
                @chmod($options['avatars_dir'].'/'.$id.'.jpg', 0644);
                @unlink($options['avatars_dir'].'/'.$id.'.gif');
                @unlink($options['avatars_dir'].'/'.$id.'.png');
            }
            else if ($uploaded_file['type'] == 'image/png' || $uploaded_file['type'] == 'image/x-png')
            {
                $temp = @move_uploaded_file($uploaded_file['tmp_name'], $options['avatars_dir'].'/'.$id.'.png');
                @chmod($options['avatars_dir'].'/'.$id.'.png', 0644);
                @unlink($options['avatars_dir'].'/'.$id.'.gif');
                @unlink($options['avatars_dir'].'/'.$id.'.jpg');
            }

Re: I can see no images

Ah, of course. Perhaps I should add something similar to the PunBB source code. I wonder what would be the best default umask.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: I can see no images

Kennel wrote:

Ah, of course. Perhaps I should add something similar to the PunBB source code. I wonder what would be the best default umask.


644 feels safe, rw for the owner and just read for others?
it´s public at the web so i can´t se any reason not having it system worldreadable.

i just added the "@chmod($options['avatars_dir'].'/'.$id.'.gif', 0644);" line for each filetype, is there a better way?

Re: I can see no images

Gribber wrote:

644 feels safe, rw for the owner and just read for others?
it´s public at the web so i can´t se any reason not having it system worldreadable.

Nope, I was just wondering if 644 was enough. I noticed that in phpBB they chmod to 777. I can't think of a reason why though :)

Gribber wrote:

i just added the "@chmod($options['avatars_dir'].'/'.$id.'.gif', 0644);" line for each filetype, is there a better way?

No, I don't think so. The code right there isn't all that pretty anyway :)

"Programming is like sex: one mistake and you have to support it for the rest of your life."

8 (edited by Gribber 2003-08-22 15:43)

Re: I can see no images

Kennel wrote:

Gribber wrote:

644 feels safe, rw for the owner and just read for others?
it´s public at the web so i can´t se any reason not having it system worldreadable.

Nope, I was just wondering if 644 was enough. I noticed that in phpBB they chmod to 777. I can't think of a reason why though smile

ehu, no, there is no reason for doing that, the only one that need write access, is the one who uploads all images, witch should be the same as the one who deletes it when someone wants to change avatar, everybody else should be fine with readonly.
And why phpBB give them world read/exec/write is a mystery, cant be good at any point.

edit: update.

9

Re: I can see no images

on what line do you put in the code you are reffering to??