Custom image sizes for custom field media uploads

Is it possible to resize my image uploads to different settings, depending on what custom field I’m on?

I’m using wpalchemy, and have an image uploader for a heap of different custom fields. It would be great if I could detect which custom field I’m currently on, and have different dimension options.

For example, if the custom field is my_special_image, I could stipulate 960x200px hard cropping, similar to featured posts.

Solutions Collecting From Web of "Custom image sizes for custom field media uploads"

Have you considered using WP’s add_image_size function? Here’s the Codex entry.

Basically you could add all the sizes you require throughout your theme via your functions.php and then call the appropriate size in your page/post template.

Good luck!

Add this to your themes functions.php file underneath your existing image sizes:

add_image_size( $name, $width, $height, $crop );

Example:

add_image_size( 'home-bottom', 280, 150, TRUE );