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条)

报告相同问题?

悬赏问题

  • ¥20 我想使用一些网络协议或者部分协议也行,主要想实现类似于traceroute的一定步长内的路由拓扑功能
  • ¥30 深度学习,前后端连接
  • ¥15 孟德尔随机化结果不一致
  • ¥15 apm2.8飞控罗盘bad health,加速度计校准失败
  • ¥15 求解O-S方程的特征值问题给出边界层布拉休斯平行流的中性曲线
  • ¥15 谁有desed数据集呀
  • ¥20 手写数字识别运行c仿真时,程序报错错误代码sim211-100
  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了