I’m currently working on a gallery plugin similar to the one found on Posterous. I’m needing all images in the gallery in a very small thumbnail-size. Probably only 50px wide.
What’s the best practice to implement the image resizing?
1.) Adding the Image size via add_image_size()?
This method has the obvious disadvantage, that all previously uploaded images aren’t resized and cannot display properly.
2.) Using timthumb.php
or other scripts to resize the thumbnails on the fly?
Its best practice to always use internal WordPress API functions that already exist in place of external scripts.
You would need to regenerate the thumbnails yourself, which is not overly difficult, if for instance you give yourself a head start and study the source code of existing and similar solutions;
browse the development trunk here
browse the development trunk here
…which are two plugins designed to do just the very thing.
Also the following is an extract from this answer on the same subject which may also in turn be taken as sample from the Regenerate Thumbnail plugin as an example or be based upon it for example sake. Either way the same suggestion applies “see how others are doing it”…
…and I agree, but at least it plants the seed. Refer to the attachments section of the Function Reference in the Codex for a list of common image related functions, in particular (but not limited too),