2

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.

0

2 Answers 2

1

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!

2
  • No offense, but IMO we don't answer to provide hints. I think comments are meant for that. I hope you understand.
    – its_me
    Commented May 4, 2012 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
    Commented May 5, 2012 at 5:23
0

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 );
1
  • 1
    An explanation why and how that solves the problem would be useful. :)
    – fuxia
    Commented Oct 22, 2012 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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