Reputation: 573
I don't know why Drupal stopped generating thumbnails. So, I get error on files like this:
/sites/default/files/styles/choices/public/a1531172504.jpg?itok=Wn-VWDKd
Although the full image is found in:
/sites/default/files/a1531172504.jpg
I'm working on Nginx, Drupal 7
Upvotes: 0
Views: 4182
Reputation: 21
The solution for me was to add this lines to the nginx.conf
files:
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
try_files $uri $uri/ @rewrite;
}
location @rewrite {
# not working with Drupal rewrite module: rewrite ^/?(.*?)/?$ /index.php?q=$1&$args;
rewrite ^/?(.*?)/?$ /index.php/$1&$args;
}
My environment is:
- docker-compose with nginx (nginx:1.17.4-alpine), drupal
(drupal:9.0.6-fpm-alpine) and mysql (mysql:8.0)
- drupal (9.0.6), nginx/1.17.4, PHP 7.4.10, MySql 8.0.21
The server responded with a 404 error
because:
The rule I propose for the nginx.conf
redirect the image request to drupal
and solve the problem after restart the web server:
docker-compose restart webserver
Upvotes: 2
Reputation: 36
My fix was to disable and re-enable the clean-url. .../admin/config/search/clean-urls"
.
Upvotes: 0
Reputation: 301
Last time I've answers question related to image derivatives I've got minuses so let be thorough here.
1.Drupal core will NOT create image derivative upon image upload - fact.
2.Thumbnail image (derivative from original image) is physically created upon HTTP request eg. if you visit the listing where image is used (when you visit the listing with thumbnail image the derivative is created on the fly via HTTP request)
3.To alter this behavior and to get a derivative image instantly upon image upload via CCK field you must use module Imageinfo Cache https://www.drupal.org/project/imageinfo_cache
With this info form above please recheck your site (go to listing where the thumbnail should appear and than check your thumbnail folder) If the image is still missing please provide more details like: Are you using CCK field or is it a custom field, are you creating derivative programmatically? Some code snippets are required here to solve you problem.
Also please check your .htaccess located in sites/default/files/.htaccess (not the general .htaccess) and while you there check the permissions on files folder.
Upvotes: 3