WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

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!

share|improve this answer
No offense, but IMO we don't answer to provide hints. I think comments are meant for that. I hope you understand. – its_me May 4 '12 at 3:08
John's answer, while not going into detail, does provide the base for what Michael needs. Don't go against someone just because they didn't provide a complete answer. – Pippin May 5 '12 at 5:23

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

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


add_image_size( 'home-bottom', 280, 150, TRUE );
share|improve this answer
An explanation why and how that solves the problem would be useful. :) – toscho Oct 22 '12 at 12:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.