donglang8008 2010-05-12 23:55
浏览 88
已采纳

PHP图像动态调整大小与存储调整大小的图像

I'm building a image sharing site and would like to know the pros and cons of resizing images on the fly with PHP and having the resized images stored.

Which is faster?

Which is more reliable?

How big is the gap between the two methods in speed and performance?

Please note that either way the images go through a PHP script for statistics like views or if hotlinking is allow etc... so is not like it will be a direct link for images if I opt to store the resize images.

I'll appreciated your comments or any helpful links on the subject.

  • 写回答

4条回答 默认 最新

  • doushi9376 2010-05-13 00:00
    关注

    This sounds like premature optimisation. Do you know how many users your site will have/ how much computational grunt your server(s) will have? Go with the simplest (maintenance-wise) option, i.e. resize on the fly, until performance becomes an issue, then figure out from there what to do.

    It might be an idea to implement some sort of server side caching of your rescaled images, if they're likely to be repeatedly hit, but I don't think this need extend as far as explicit pre-rendering.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

悬赏问题

  • ¥15 powerbuilder中的datawindow数据整合到新的DataWindow
  • ¥20 有人知道这种图怎么画吗?
  • ¥15 pyqt6如何引用qrc文件加载里面的的资源
  • ¥15 安卓JNI项目使用lua上的问题
  • ¥20 RL+GNN解决人员排班问题时梯度消失
  • ¥15 使用LM2596制作降压电路,一个能运行,一个不能
  • ¥60 要数控稳压电源测试数据
  • ¥15 能帮我写下这个编程吗
  • ¥15 ikuai客户端l2tp协议链接报终止15信号和无法将p.p.p6转换为我的l2tp线路
  • ¥15 phython读取excel表格报错 ^7个 SyntaxError: invalid syntax 语句报错