I'm using the image module. Attached an image to a "page" but can't see it when not logged in. I gave anonymous users permission to view original images.

Any ideas? Looks like it should be pretty simple, but I've searched the site and can't find any answers.

Comments

p6’s picture

Rebuild Node Permissions. (Admin >> Node Settings >> Rebuild or something like that)

- Pavan Keshavamurthy
http://grahana.net/

- Pavan Keshavamurthy
http://grahana.net/

cog.rusty’s picture

Also check the "view uploaded files" permission for anonymous users in admin/user/permissions.

Are you using the "Public" or the "Private" download method in admin/settings/file-system?

bob_irving’s picture

OK, I rebuilt the node permissions.
Enabled the upload module and checked the "view uploaded files" permission fo anonymous users.

I'm using the Public download method in admin/settings/file-system. Should I be using the Private method?

TIA

cog.rusty’s picture

No, the public method is easier to work with and also faster, if you don't need to control access to the files.

What is strange is that, if the images have the right URL, then Drupal shouldn't be able to prevent any user role to see them. When you say that some users see them and some don't, are you comparing the exact same page?

Check the html source of that page in your browser. Do the <img src=... tags exist, and what is the exact image path which they are using?
- Is the image's path correct?
- Does it have a front slash or not?
- Are you using clean URLs?
- Is your site's home URL just a domain name, or does it contain a subdirectory path?

bob_irving’s picture

When you say that some users see them and some don't, are you comparing the exact same page?
Yes, it's the front page.

Check the html source of that page in your browser. Do the img src=... tags exist, and what is the exact image path which they are using?"
img src= tag exists in the source for the page when I'm logged in as admin, not when no one is logged in.

- Is the image's path correct?
Yes.
- Does it have a front slash or not?
No front slash. It's an absolute link to http://etc"
- Are you using clean URLs?
Yes.
- Is your site's home URL just a domain name, or does it contain a subdirectory path?
It's a subdirectory path: www.elementalsource.com/drupal6 is the main page.

I created a test authenticated user in the role of authenticated user, logged in, and I can't see the image. So there must be something in the permissions, perhaps in the image module??

Does any of this make any sense?

Thanks again!

cog.rusty’s picture

Not much sense. The direct image links should either work or not, for everyone. Drupal has no control over them.

Test them by direct browsing to them, double-check the URLs in the html source, check whether the referenced files exist where the URL says and whether they are readable by the web server (user apache).

However, I still don't see how Drupal could allow specifically to the admin user to see the images, if the web server can serve them. Drupal could do that by using virtual URLs for the files, but you are using real URLs, which it can't control.

------ Edit:

I just noticed that you said that the img tags disappear for the other users, which explains that behavior. But I don't have any idea why. It is clearly an access control issue.

bob_irving’s picture

I did some searching here for image.module and permissions and found many posts, some from 2004 and some from recently. Looks like there have been people with issues off an on through the last few iterations. Maybe it's just newbie drupal admin errors.

I'm wondering if I should move to another solution for inline images. I chose the image module because someone said it was the simplest solution, but it's not turning out that way for me.

I did double-check the URL in the html source, and that checks out -- images are there. I will check to see if they're readable by user apache.

Thanks again.

cog.rusty’s picture

Do you have any access control module such as organic groups or nodeaccess or taxonomy access or image gallery access with acl? Or did you have one and disabled it but didn't uninstall it? Check your node_access table in the database. Without any access control modules installed, there should be only one single row with realm=all.

The image module is a straightforward solution only if you need its image management/categorizing/listing functionality without having to assemble this functionality yourself, for example with image fields. If you just want to insert images in nodes there are simpler solutions.

bob_irving’s picture

I have OG and image gallery both activated.

What's a simpler solution for just inserting images? I chose the image module after reading it was a simple solution...

Thanks, cog.

cog.rusty’s picture

IMCE module is much simpler if you don't need all the management and categorizing of the images by gallery, and you just want to insert images in posts and to manage them by browsing the directory where they are stored.

http://drupal.org/project/imce

The images do not become nodes, so you can't have node access problems.

bob_irving’s picture

OK, I installed FCKEditor and IMCE and got them working nicely together. Woo hoo!

You can take a look at my site in progress at www.elementalsource.com/drupal6.

Now on to the next issue!

Really appreciate your help, cog.rusty.

mrtbc’s picture

You may also need to check user permissions for the different Image Cache sizes. I was having the same problem and had to grant Anonymous Users access to view the appropriate sizes.

oknate’s picture

Yeah, I had this problem too.

Turns out it was a permissions issue. When you create a new content type, you can allow/disallow visibility for each field. Also, with image cache, you can allow/disallow visibility for each imageCache type.

For some reason (at least on my install) these are all turned off by default, so I logged out after setting up my new content type to discover (to my horror) that the images had disappeared. A few frantic minutes of googling led me to this thread and I felt obligated to chime in. Changing permissions worked. Just read through the list carefully for anything you might want shown by default that isn't allowed to unauthenticated visitors.

PauloHaitch’s picture

Had the same issue with attached images not showing for anonymous users after migrating a Drupal site.

It seemed obvious that it must be permissions related but everything had been working before migration. I checked permissions and all looked OK still but Authenticated user could view images, Anonymous could not.

I had forgotten that I'd installed the FileField module since the migration and had been logged in since then. It didn't seem relevant anyway because the images are old and were not uploaded via that module. In desperation I tried granting 'view filefield uploads' permission to anonymous users and to my surprise that fixed the problem!

michaelbstringer’s picture

My issue was with the content permissions module. I finally tried setting permissions under the "Content Permissions Module" on the permissions page. It seems a little redundant to have to enable all of the fields under that heading, but that is what brought the images back for anonymous users.

hayzhold’s picture

I had the same problem when setting up an image gallery in Drupal 6.x.

I had used http://www.ireckon.com/web-dev/cms/drupal/creating-a-drupal-photo-gallery/ as an outline for building the gallery with Galleria, jCarousel, CCK (as listed on that site).

When I was logged in as admin, everything was good. When I logged out and came to the site as an anonymous user, no main picture, no thumbnails, no carousel ... just frustration.

I had checked all the permissions (I thought) and images, etc. were all open to anon users.

PualoHaitch's reply reminded me that I had also used the ImageField and FileField modules to get the gallery working. So, I went back to my permissions list and noticed that I had not allowed anonymous users to access "view field_image" in the content_permissions module. I checked those off and everything came up immediately.

Here's hoping that my mistakes and hours of Googling can pay off for you if you're in a similar position.

Jason

borgo’s picture

CCK has 'Content permissions' submodule, which sets field-level permissions for CCK fields. Disable it, or set View permission for that specifc field under in permissions table.