Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
add comment

2 Answers

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 );
share|improve this answer
1  
An explanation why and how that solves the problem would be useful. :) –  toscho Oct 22 '12 at 12:56
add comment

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
1  
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 comment

Your Answer

 
discard

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.