Title: Process uploads with phpThumb before generating thumbnails
Last modified: August 21, 2016

---

# Process uploads with phpThumb before generating thumbnails

 *  [Nathan Adams](https://wordpress.org/support/users/nathan-adams/)
 * (@nathan-adams)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/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
    `<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

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [rfmeier](https://wordpress.org/support/users/rfmeier/)
 * (@rfmeier)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/process-uploads-with-phpthumb-before-generating-thumbnails/#post-3824579)
 * Hello,
 * That sounds like a great idea. You may be able to skip the **phpThumb** totally
   by using image filtering while WordPress is generating the images.
 * Otto made a great post this a while back using the ‘wp_generate_attachment_metadata’
   filter on the image.
 * [http://ottopress.com/2011/customizing-wordpress-images/](http://ottopress.com/2011/customizing-wordpress-images/)
 * and here is the PHP filter support.
 * [http://php.net/manual/en/function.imagefilter.php](http://php.net/manual/en/function.imagefilter.php)
 * and the WordPress documentation
 * [http://codex.wordpress.org/Function_Reference/wp_generate_attachment_metadata](http://php.net/manual/en/function.imagefilter.php)
 * I hope this helps.
 *  Thread Starter [Nathan Adams](https://wordpress.org/support/users/nathan-adams/)
 * (@nathan-adams)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/process-uploads-with-phpthumb-before-generating-thumbnails/#post-3824672)
 * Thanks for the response. Unfortunately it looks like I’m stuck with phpThumb,
   as imagefilter doesn’t have support for masks.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Process uploads with phpThumb before generating thumbnails’ is closed
to new replies.

## Tags

 * [images](https://wordpress.org/support/topic-tag/images/)
 * [media](https://wordpress.org/support/topic-tag/media/)
 * [phpthumb](https://wordpress.org/support/topic-tag/phpthumb/)
 * [process](https://wordpress.org/support/topic-tag/process/)
 * [upload](https://wordpress.org/support/topic-tag/upload/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Nathan Adams](https://wordpress.org/support/users/nathan-adams/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/process-uploads-with-phpthumb-before-generating-thumbnails/#post-3824672)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
