Saturday, 8 June 2013

Process uploads with phpThumb before generating thumbnails

Process uploads with phpThumb before generating thumbnails

I was wondering if anyone knew a way (via function, plugin, or another method) of using phpThumb to process an image on upload, and then for Wordpress to generate it's usual image sizes from both the original and the processed image?
Basically I'm using phpThumb to generate an alpha channeled version of the image, to use in some specific areas, using this (where the h & w are the measurements or the original image, which could be variable)
<img src="phpThumb/phpThumb.php?src=black.jpg&h=487&w=320&iar=1&fltr[]=mask|originalimage.jpg&f=png&hash=xxxxxx">
If I then set a bunch of custom image-sizes, for example:
add_image_size( 'normal-large', 800, 400, false );
add_image_size( 'normal-medium', 600, 300, false );
add_image_size( 'normal-small', 40, 200, false );
add_image_size( 'mask-large', 800, 400, false );
add_image_size( 'mask-medium', 600, 300, false );
add_image_size( 'mask-small', 40, 200, false );
I'd like for the three normal-x sizes to generate from the original image, as per normal, and then the three mask-x sizes to be generated, using the processed version of the image.
Cheers

No comments:

Post a Comment