[英]php image save/resize/show practices
What are the best practices on image handling on a php driven web site when several versions of the same image are required (different sizes), bear in mind it's a high load website: 需要相同图像的多个版本(不同大小)时,在php驱动的网站上进行图像处理的最佳实践是什么,请记住这是一个高负载的网站:
If its a high traffic website, i would suggest you go with #1. 如果网站流量高,我建议您选择第一名。 Also keep in mind that if this is a high traffic website, you might need to move to a CDN soon, in that case it would be ideal to generate all thumbs and upload to your CDN and load in the page with a cookie-free domain.
还要记住,如果这是一个高流量的网站,则可能需要尽快移至CDN,在这种情况下,最好生成所有大拇指并上传到CDN并使用无Cookie的域加载到页面中。
If your images is something like avatar or gallery image and he in many cases was be viewed by other peoples or by the people who uploading image, use option #1
, this is very good way because time to generate image you can assign to upload time, then if this algorithm was be errored will be reasonable submitted to user. 如果您的图像是头像或画廊图像之类的东西,并且在很多情况下他是被其他人或上载图像的人查看的,请使用选项
#1
,这是一种很好的方法,因为生成图像的时间可以分配给上载时间,则如果此算法有误,则会合理地提交给用户。
But if your uploaded images can never was be viewed think about option #3
, this case is not good in overall because some images may be corrupted and you know this in generation time while you must show image. 但是,如果无法查看您上传的图像,请考虑选项
#3
,这种情况总体上不好,因为某些图像可能已损坏,并且您必须在生成时知道这一点,因此必须显示图像。 I will be don't use this solution. 我将不会使用此解决方案。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.