开发者

Should i re-size images on the fly or store them

Im writing an application which does an image search using flickr webservice. Currently im just storing the url of each image returned in the databse.

Now i need to perform image re-sizing, should i actually store each resized image 开发者_运维技巧on the server or is there a way i can re-size on the fly or something (ie. use gd library to spit out the resized image without storing it on the server or db).

thanks


Since this is tagged as PHP, I assume this is a website? You can "resize" on the fly simply by changing the width and height of the image tag. However, the disadvantage of this is that:

  1. The full image still needs to be transferred (even if the resized image is smaller), and
  2. The browser must perform the resizing, leading to slightly higher rendering time.

Precomputing the resized image, and returning that image will lead to lower latency (by reducing the number of bytes transmitting, and removing the need to resize on the client). However, performing client-side resizing (by changing the "width" and "height") parameter is viable if necessary.


Resize on the fly is always a NOOOOOOOOOOOO solution.

You can either resize on demand or on adding the picture, but you always have to store the thumbnailed result and use it on the next request.


Depending on how many you have and how frequently they're accessed it could change but typically you would store them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜