dptn69182 2012-06-27 11:25
浏览 45
已采纳

调整网站图像大小以提高效率。

I currently have a website that aggregates images, the problem is those images are very large, and when I display them at smaller sizes, they still eat up a lot of computation.

I'm curious as to how to actually force reduced size/quality without just smooshing it into a <div> element.

Here is my site in question, you can see how 'laggy' it gets when you produce images: http://newgameplus.nikuai.net/TEST/index.html

I was using timthumb.php to resize the images, but the host doesn't allow that script for some reason.

  • 写回答

2条回答 默认 最新

  • doulu8537 2012-06-27 12:05
    关注

    The best way to do this is to use some sort of image re-factoring service.

    I have written my own one that uses ffmpeg and imagemagik to resize images on the fly and to generate arbitrarily sized thumbnails from videos. I memcache the results to make subsequent requests super snappy, and have some interesting additions such as automatic Point of Interest detection using Face Detection and Image Entropy, with the aim being "nice thumbnails, no matter the size"

    An example of such a service is src.sencha.io - the documentation for this service is here but I have included the important bits below.

    Specify Image Size

    <img src='http://src.sencha.io/320/200/http://yourdomain.com/path/to/image.jpg'
         alt='My constrained image'
         width='320'
         height='200' />
    

    This will take your image (http://yourdomain.com/path/to/image.jpg) and run in through the resizing service, returning a 320x200 version of your image. You cannot set the gravity/point-of-interest using this service though (as far as I can tell).


    You can also use this service to change formats, resize dataurls, do percentage resizes and use the resizing service to detect the width/height of the user agent requesting the image.

    There are many such services available on the web.

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

报告相同问题?

悬赏问题

  • ¥15 2024-五一综合模拟赛
  • ¥15 如何将下列的“无限压缩存储器”设计出来
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口