سؤال

I have a collection of 500+ images which have been re-sized to a maximum of 800px x 533px with a need to display thumbnails of these in a variety of sizes depending on the number in a particular category, so a section width of say 650px is filled in either 2/3/4 columns of photos. These images will are planned to bed used on a number of different domains each with a seperate watermark.

Therefore i wrote a script which re-sizes images based on certain parameters (width / height / aspect) and then adds a watermark on the fly. I did this because i wanted to save server space and be as dynamic as possible to display which will allow the both the watermarked thumbnail and full photos to be displayed at different sizes on a number of domains.

My questions are:

  1. Have i done the right thing in terms of using the on-the-fly watermarking approach?

  2. Would i better off saving a copy of the unwatermarked photos in lesser dimensions (300px x 200px) and reference those for the thumbnail?

  3. Should i create a separate copy of each photo (and maybe thumbnail as well) already watermarker with the specified logo and save it to the individual domain folder? Even though this would mean mass duplication

Many thanks for your advice

هل كانت مفيدة؟

المحلول

Do you use Image Magick?

There are reasons why you would want to do it dynamically and why you wouldn't. Both approaches are valid. Here are pros and cons:

  • performance is better if you cache the images. Server space - which you see as a concern - is cheap these days and shouldn't be a factor. Latency on the other hand creates a poor user experience
  • Your scripts may not have the right to execute the image processing script you wrote and you depend on the server more if you do it dynamically.
  • If you decide to change the size of your thumbnails, in a dynamic scenario, you won't need to regenerate all the thumbnails since you don't store them.
  • watermarking: choose to watermark the images you want to protect. If thumbnails are used for quick viewing of a large file (the "sensitive" asset) then don't watermark your thumbnails.

These are just general rules. Nothing set in stone.

On my own server (where I use wordpress), thumbnails are generated at picture upload time. That gives me better viewing performances when visitors hit my page. BUT, if I decide to redesign my website and change the thumbnail format, I have to regenerate all the pictures.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top