PHP based high resolution image combiner
We needed a PHP based high resolution image combiner that took two folders:
- Low Resolution - any file file type
- High Resolution - again any file file type
and to make a little more complicated the images existed multiple times throughout a complex folder hierarchy.
The following script uses PHP 5's RecursiveDirectoryIterator to loop through the folders and then uses the returned file object to get the size of the image performing a simple check based on the logic that the largest image is most likely the high-res version.
https://gist.github.com/3060960
The file is executed by running it from the command line as such: php ./imagecombine.php