php Img Optimizer

Sometimes we find that the images we have on the web are larger than we would like them.

It is helpful in this case to recursively scan a folder, pick out all files larger than our certain threshold and preview them (as thumbnails), resizing the ones we want to.

If the files are ridiculously large in the first place, we may want our preview to be of a resized thumbnail. Credit to Simon Jarvis for his component.

Some of the challenges are:

  • Scanning recursively and resizing images as we encounter them takes too long and the script times out.
  • Paging would solve this, but we cannot page items in a recursive scan. The thresholds may differ from page load to load.
  • Flagging files to skip.

Leave a Comment