dongliu8542 2011-11-18 14:03
浏览 31
已采纳

PHP图像缩略图表现?

I've recently started trying to increase my sites performance. One of the biggest obstacles I have are the number of thumbnails being displayed.

I currently use the full size image and scale it down by defining a height/width value in the img tag. This doesn't seem very efficient so my question is whats the recommended way to display thumbnails? Should I maintain a second table in the DB for thumbnails or is there a better solution?

  • 写回答

6条回答 默认 最新

  • duanfengshang1088 2011-11-18 14:11
    关注

    Processing images takes its (cpu) toll, you should better avoid it where possible.

    My advice: Create the thumbnails while uploading the images into separate image files, this way you can determine when to create/resize them - and not during runtime.

    If you want the links to the thumbnails in a separate database field or derive it from the original name, is entirely up to you - both ways work.

    This makes additional performance boosters easier to implement too (p.e. caching).

    I've implemented a similar process in a php based project, its a good way to scale out. In my case, I am creating the thumbnails nightly via cron, because system load is very low in that time.

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

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度