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.

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!

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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