I'm having a strange problem with the images on my website (Drupal 7.19). After migrating the site from the testing to the production server we weren't able to see images we've uploaded. Since we're a closed community all the images are uploaded to the private folder, which perfectly works. The images are there in the folder.
But when we try to access the images (and if it's just showing them as thumbnails on the page) we get a "broken image" icon - they're not available, neither the thumbnails nor the large version. The Drupal log then says "Access denied" for the user "guest", for every logged in user, even me as administrator. If I try to open the image via the direct link (e.g. from the Drupal log) Drupal shows a login page and after I log in I can perfectly see the image.
So I find this rather strange and I don't know how I should fix this problem. Since we needed a tight security plan I installed several extra modules like "Content Access" and "Taxonomy Access Control". I wonder if it has something to do with that? Or with the new server?
Thanks for reading and I hope someone can help me! I'm already pretty desperate!
Have a nice day, Svenja
PS: Strangely I found another two warnings in the log immediately after I uploaded an image. Maybe this could be a clue? "Warning: session_start(): Cannot send session cookie" and: "Warning: session_start(): Cannot send session cache limiter" - maybe that's a clue? (I have no idea...)
Comments
There is a cookie handling
There is a cookie handling problem. It may be related to the server. Probably not related to the extra modules you installed. Also check you have not set cookie domain in settings.php (unless you want to set it and you know what you are doing).
Digit Professionals
It's not the cookie domain in settings.php
Hi John,
thanks for the answer. It's not the cookie domain in settings.php, that's not set.
Which kind of problem could that be with cookies and our hoster? I don't have so much of a clue how much a hoster influences the cookies.
--------------
Using Drupal in a university context.
I do not know and it probably
I do not know and it probably depends on which webserver software they are using. One thing that can happen in my experience is when using Varnish, cookies need to be removed so that that the software knows a file is safe to be cached, but if authentication cookies are removed then after first login the site logs you out.
If you are paying for hosting, the host should fix the problem. If they do not, I would suggest switching to a Drupal specialist host who should have the quality of service to handle this type of problem. Unfortunately many hosts hire low-grade engineers for their support department sometimes then just blame Drupal, but if your host does support Drupal they should sort this out.
Digit Professionals
Wrote to the support
Hey,
I wrote to the support and asked them if the hosting could be the problem. I'll post here what I found out.
Thanks anyways! :-)
--------------
Using Drupal in a university context.
I can confirm this issue on
I can confirm this issue on my site. Images were working fine before update to 7.19 and after they're all showing access denied in the log. After uploading a new image I get this error:
Warning: Cannot modify header information - headers already sent by (output started at /includes/common.inc:2681) in drupal_send_headers() (line 1216 of /includes/bootstrap.inc).I guess I'm not seeing how this is suddenly a server issue when the site was working fine before the update. Right now this is just on my local setup (MAMP). What would I need to do to fix this if it is a server side issue?
If the image is giving access
If the image is giving access denied and it is in a folder which is supposed to public, you should surely try to open the image in a browser and find out why it is not being served. If the image is in a private folder then you may suspect Drupal. Any file in a public folder should be served without Drupal running at all. Therefore if you have an image with the path for example /users/Name/Sites/drupal-site/sites/default/files/images/image.jpg, just try to open that in browser. What happens?
Digit Professionals
All my public images are
All my public images are served with no issue. It's only the private images. They show the broken image icon and my log is full of access denied error and I get the same if I try to path directly to the image in the browser, for example mysite.local/system/files/styles/dashboard_myproducts/adaptive-image/private/TW%20Telecom/products/dvw3201b.jpg
It does look like some faulty
It does look like some faulty code. Someone else had a similar issue http://drupal.org/node/1890036. Whilst turning php output buffering on may fix the 'headers already sent' problem, it sounds like it is time to start disabling modules to try to narrow down where the problem is coming from.
Digit Professionals
So I figured this out...
So I figured this out... sorta.
There was a new change to image.module in the latest release (http://drupalcode.org/project/drupal.git/blobdiff/b47f95d3013619e33cafdf...). If you revert this code back all of the images load again. Of course I'm not recommending hacking a core module, I just don't quite follow what this change does.
Am I correct in understanding that the original code only checks that users aren't restricted (!in_array(-1, $headers)) and the new code also adds a conditional to ensure that the user has been granted access (!empty($headers))?
So how do you grant users access to the images?
[Edit]: And Adaptive Images module is the culprit (for me anyway)! Which I'm actually thinking in that case it doesn't matter if it's public or private. Adaptive images seems to add another element to the file URI for the breakpoint, which doesn't exist in the file structure and causes $headers = module_invoke_all('file_download', $original_uri); to return empty.
Well done for tracking it
Well done for tracking it down. I note there are some new bug fixes for Adaptive Image module so it may be worth trying the dev version.
Digit Professionals
I tried the dev version and
I tried the dev version and no luck. I started an issue on it at #1905590: Access denied on private images in Drupal 7.19.