在我的 Laravel 5.1 应用程序中,我使用https://github.com/thephpleague/glide https://github.com/thephpleague/glide通过以下方式调整图像大小并提供图像.cache
目录一旦调整大小。我遇到了完全相同的问题Laravel Glide 未在带有扩展名的 url 中找到图像 https://stackoverflow.com/questions/30332539/laravel-glide-not-finding-images-at-urls-with-extension
必须在 NGINX 中禁用缓存:
# cache.appcache, your document html and data
location ~* \.(?:manifest|appcache|html?|xml|json)$ {
expires -1;
access_log logs/static.log;
}
# Feed
location ~* \.(?:rss|atom)$ {
expires 1h;
add_header Cache-Control "public";
}
# Media: images, icons, video, audio, HTC
location ~* \.(?:jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp4|ogg|ogv|webm|htc)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
# CSS and Javascript
location ~* \.(?:css|js)$ {
expires 1y;
access_log off;
add_header Cache-Control "public";
}
# WebFonts
# If you are NOT using cross-domain-fonts.conf, uncomment the following directive
location ~* \.(?:ttf|ttc|otf|eot|woff|woff2)$ {
expires 1M;
access_log off;
add_header Cache-Control "public";
}
禁用这些规则后,我可以再次访问图像。有小费吗?启用此功能后,我仍然可以“看到”图像,但我的服务器无法读取它们。对这里可能发生的事情有点迷失。谢谢你的帮助!
取“jpg|jpeg|gif|png|”匹配完毕后,重新启动 nginx,清除浏览器缓存。 Glide 会对图像的缓存进行排序。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)