My images will not show in drupal just a box with an X i have moved the image folder to each users home directory and chmoded them to 777 please help

Comments

cog.rusty’s picture

First thing, look at the img tags in the html source in your browser (if they exist) and compare their paths with where the files really are.

c0mputerking’s picture

here is the html code

Only local images are allowed.

root@mx1:/var/www/drupal-5.7/sites/computerking.ca/drupal/files/images/links# ls -l

-rwxrwxrwx 1 computerking computerking 1800 2008-06-17 02:08 google.gif

filesystem path is set to this
sites/computerking.ca/drupal/files

I also get this error sometimes
The selected file /var/www/drupal-5.7/sites/computerking.ca/drupal/files/tmp/fileqL3SKw could not be uploaded, because the destination sites/computerking.ca/drupal/files/xmlsitemap/sitemap.xml.gz is not properly configured.
Unable to load site map. Make sure that there is an xmlsitemap directory in your files directory and that it is writable by Drupal.

c0mputerking’s picture

no one has any ideas??? leads anything???

c0mputerking’s picture

WTF No one has any ideas please help totally lost need help here

cog.rusty’s picture

From your answer, I still don't know:
- whether or not the html source in the browser contains img tags for those images
- what are the file paths in those img tags (if they exist)

It is not possible the html code to contain /var/www/.... because that path is not accessible from the Web. So, I couldn't say anything meaningful.

If you wrote some html which didn't show in your post, try to put it inside <code> tags

c0mputerking’s picture

sorry about the lame reply thought you could see the html guess i should have done a preview. I pulled this html code from the edit feature in drupal on one of the pages i question.


<a target="_blank" href="http://google.ca"><img width="139" src="/sites/computerking.ca/drupal/files/images/links/google.gif" alt="Google.ca" height="48" style="width: 139px; height: 48px" title="Google.ca" /></a>

Just to quote myself

root@mx1:/var/www/drupal-5.7/sites/computerking.ca/drupal/files/images/links# ls -l

-rwxrwxrwx 1 computerking computerking 1800 2008-06-17 02:08 google.gif

filesystem path is set to this
sites/computerking.ca/drupal/files

I also get this error sometimes
The selected file /var/www/drupal-5.7/sites/computerking.ca/drupal/files/tmp/fileqL3SKw could not be uploaded, because the destination sites/computerking.ca/drupal/files/xmlsitemap/sitemap.xml.gz is not properly configured.
Unable to load site map. Make sure that there is an xmlsitemap directory in your files directory and that it is writable by Drupal.

also these files do seem to live inside the web root??? as i have this in apache virtual host file


DocumentRoot /var/www/drupal-5.7

<Directory /var/www/drupal-5.7>
    Options Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

ps thanks for the reply
pps i have messed with the public private settings could this cause problems?

paulnem’s picture

Looking at your products page I see 2 images not displaying. When I try to browse directly to where the images are supposed to be I get a Forbidden message.

http://computerking.ca/sites/computerking.ca/drupal/files/imagecache/pro...

This is more than likely an issue your your directory settings in apache. It appears all the files under your /files dir are accessible but under your /sites they are not. Who owns the sites directory and files under it? Do you have any apache settings that would disallow access to these files?

If may be a nice first step to chown -R your entire install to the correct user and group, for examples.

chown -R daemon:daemon /var/www/drupal-5.7/*

c0mputerking’s picture

Wow that worked do not know why i did not think of it played with permissions for hours but never changed the owner of the site directory du do i feel stupid. However there were some compications with broken server a reinstall and complete migrations of all services.

Thanks a million that really helped however this brings me to another question what should the perms be because i messed them all up tring to fix this probelm.

here is how the look now i changed the owner of the site to the site user rather than the apache user which is more correct/secure the website owner or apache owner? what about the files dir and the files themselfs (Pretty sure the website owner is in the apache group)

did this
chown -R computerking.ca:computerking.ca computerking.ca

things now look like this (i know the rest of the sites need to be fixed now ie creativehangups.com
root@mx1:/var/www/drupal-5.7/sites# ls -l

drwxr-xr-x 4 computerking.ca computerking.ca 4096 2008-06-19 22:19 computerking.ca
drwxr-xr-x 2 root root 4096 2007-10-29 21:18 creativehangups.com

root@mx1:/var/www/drupal-5.7/sites/computerking.ca# ls -l
total 28
-rw-r--r-- 1 computerking.ca computerking.ca 7049 2008-05-28 17:03 civicrm.settings.php
drwxrwxrwx 4 computerking.ca computerking.ca 4096 2008-06-17 02:08 drupal
lrwxrwxrwx 1 computerking.ca computerking.ca 25 2008-06-15 13:29 g2data -> /home/computerking/g2data
lrwxrwxrwx 1 computerking.ca computerking.ca 27 2008-06-15 13:29 gallery2 -> /home/computerking/gallery2
lrwxrwxrwx 1 computerking.ca computerking.ca 32 2008-06-15 13:29 gallery2data -> /home/computerking/gallery2data/
-r--r--r-- 1 computerking.ca computerking.ca 1742 2008-05-28 11:55 settings.php
-rw-r--r-- 1 computerking.ca computerking.ca 6023 2007-10-29 21:18 settings.php-dist
drwxrwxrwx 7 computerking.ca computerking.ca 4096 2008-06-19 18:28 testfiles

root@mx1:/var/www/drupal-5.7/sites/computerking.ca/drupal# ls -l
total 8
drwxrwxrwx 7 computerking.ca computerking.ca 4096 2008-06-19 16:37 files
drwxrwxrwx 2 computerking.ca computerking.ca 4096 2008-06-19 16:31 images

root@mx1:/var/www/drupal-5.7/sites/computerking.ca/drupal/files# ls -l
total 268
-rw-r----- 1 computerking.ca computerking.ca 16454 2008-06-17 02:08 CK-2.jpg
drwxr-x--- 2 computerking.ca computerking.ca 4096 2008-06-17 02:08 computerking
-rw-r----- 1 computerking.ca computerking.ca 203316 2008-06-17 02:08 ComputerKing5.jpg
-rw-r----- 1 computerking.ca computerking.ca 3223 2008-06-17 02:08 favicon.png
drwxr-x--- 4 computerking.ca computerking.ca 4096 2008-06-17 02:08 imagecache
drwxrwxrwx 14 computerking.ca computerking.ca 4096 2008-06-19 22:21 images
-rw-r----- 1 computerking.ca computerking.ca 10348 2008-06-17 02:08 logo.png
drwxrwxrwx 2 computerking.ca computerking.ca 12288 2008-07-03 17:00 tmp
drwxr-x--- 2 computerking.ca computerking.ca 4096 2008-06-17 02:08 xmlsitemap
root@mx1:/var/www/drupal-5.7/sites/computerking.ca/drupal/files/images# ls -l
total 508
drwxrwxrwx 2 computerking.ca computerking.ca 4096 2008-06-17 02:08 administrat ion
drwxrwxrwx 2 computerking.ca computerking.ca 4096 2008-06-17 02:08 affiliates
-rwxrwxrwx 1 computerking.ca computerking.ca 43 2008-06-17 02:08 bg_body.gif
-rw-r----- 1 computerking.ca computerking.ca 10806 2008-06-17 02:08 corel001010 .jpg
-rw-r----- 1 computerking.ca computerking.ca 347968 2008-06-17 02:08 corel001015 .tif
-rwxrwxrwx 1 computerking.ca computerking.ca 4071 2008-06-17 02:08 email.swf
-rwxrwxrwx 1 computerking.ca computerking.ca 7510 2008-06-17 02:08 emailtest.s wf
-rwxrwxrwx 1 computerking.ca computerking.ca 3094 2008-06-17 02:08 email.txo
drwxrwxrwx 2 computerking.ca computerking.ca 4096 2008-06-17 02:08 entertainme nt
drwxrwxrwx 2 computerking.ca computerking.ca 4096 2008-06-17 02:08 homepage
drwxrwxrwx 2 computerking.ca computerking.ca 4096 2008-06-17 02:08 links
-rwxrwxrwx 1 computerking.ca computerking.ca 1964 2008-06-17 02:08 LOGO2.gif
-rwxrwxrwx 1 computerking.ca computerking.ca 2425 2008-06-17 02:08 LOGO2.png
-rwxrwxrwx 1 computerking.ca computerking.ca 1964 2008-06-17 02:08 LOGO5b.gif
-rwxrwxrwx 1 computerking.ca computerking.ca 998 2008-06-17 02:08 logo.gif

ps thanks again bet this will solve my gallery embed problem too. now that things are working again i would like to tighten up security a bit with proper permissions and owners

cog.rusty’s picture

Just don't forget that Drupal is going to be creating new files and subdirectories under files/, owned by the apache user.

Other than that, all directories must allow reading/listing by user apache, and the directories where Drupal writes files must also allow writing by user apache. What this means in practice depends on the owner and the group of a directory.

cog.rusty’s picture

Direct browsing to http://computerking.ca/sites/computerking.ca/drupal/files/images/links/g... fails (access denied).

If you have set the downloads method to "private" and your "files" directory to sites/computerking.ca/drupal/files then the right URL is

http://computerking.ca/system/files/images/links/google.gif

and it does work! It is possible that some module you are using for uploading/placing images does not understand private downloads and sets the URL directly, or maybe it is just misconfigured, or the URL has been entered manually.

Normally the direct link should work also if the files are accessible from the Web, but somehow you have managed to protect them.

c0mputerking’s picture

both links work from here could you please check again???

cog.rusty’s picture

Yes, they do now. I probably checked while you were fixing the ownership and/or the permissions.