douchang8758 2013-01-10 09:01
浏览 13
已采纳

上传后即时创建大拇指

Just wondering what is better:

Create thumbs on the fly:

  • [+] easy to create numerous thumb sizes
  • [+] easy to maintenance
  • [-] wasting cpu by sending images thru PHP

Create thumbs after user upload:

  • [+] saving server cpu
  • [-] very painful to maintenance and painful to new add thumb size
  • [-] maybe the thumbs are never shown.

Any suggestions? Should i really worry about CPU? Let's say I have thousands of images, and every image needs thumb in 5+ different sizes. Maybe even more sizes in future.

  • 写回答

2条回答 默认 最新

  • duanri1985 2013-01-10 09:06
    关注

    [-] wasting cpu by sending images thru PHP

    You don't have to generate the same image again and again on each request!
    Generate the image the first time it's requested, then put it in a place where it will be served by the web server the next time. A simple implementation for this using mod_rewrite:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^(.*)$ generateImage.php?image=$1 [QSA,L]
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示