Steve
Steve

Reputation: 37

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

Upvotes: 0

Views: 178

Answers (3)

Michael Aaron Safyan
Michael Aaron Safyan

Reputation: 95509

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.

Upvotes: 1

Neddy
Neddy

Reputation: 503

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

Upvotes: 0

zerkms
zerkms

Reputation: 254926

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.

Upvotes: 0

Related Questions