1024programmer Nginx Nginx server implements drupal to automatically generate thumbnails

Nginx server implements drupal to automatically generate thumbnails

In drupal, use the image_style_url function to convert an address public://… into an externally accessible URL, this
The first parameter required by the function is the image style, which is used to specify the size of the thumbnail, in the background admin/config/media/image-styles
Configuration-media-image style is configured.

Thumbnails may not be generated before the user visits, and the ungenerated images will be generated through the rewrite rules of servers such as apache and nginx when accessing. Under the Apache server, the rewrite rules are straightforward, but under nginx, you need to modify the rewrite rules and add a few sentences, as follows:

location ~* files/styles {
access_log off;
expires 30d;
try_files $uri @rewrite;
}
location @rewrite {
rewrite ^ /index.php last;
}

That is to say, the picture will only be generated when the address is accessed, so that the picture will only be generated when needed, and can be reused after generation. If the picture is updated, you only need to delete the old one.

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/nginx-server-implements-drupal-to-automatically-generate-thumbnails/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索