Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Nicolas Juen

    (@rahe)

    Hi,

    The theme have to call the right featured image size in the code. So you have to call the right size in the ‘the_post_thumbnail’ function. If the image is not at the right size, try to regenate it.

    Thread Starter serons

    (@serons)

    Can I set different dimension for the featured image for each post?

    What I actually would like to do is to somehow store the selected image size in the post and the pick it up in the loop using for example wp_get_attachment_image_src( $ID, 'my-funky-image-size' ). How could I do this?

    Plugin Author Nicolas Juen

    (@rahe)

    When you download an image on you WordPress, WP generate all the sizes you have setted, so if the image is big enough you can have unlimited sizes. So you can call get_post_thumbnail('my-funky-image-size1') and get_post_thumbnail('my-funky-image-size2') in the loop. The function will use the image setted as featured image.
    If you have the attachment id you can call wp_get_attachment_image_src() with the id and the sizes you wanted and display them.

    Thread Starter serons

    (@serons)

    If I don’t want to have a fixed image size in the loop but want to pick the size up from the post, how could I do that?

    Plugin Author Nicolas Juen

    (@rahe)

    From the post content ?

    Thread Starter serons

    (@serons)

    From post meta data would be preferable if possible, but otherwise any way possible at all, including the content.

    Plugin Author Nicolas Juen

    (@rahe)

    If you use a plugin like advanced custom field, you can add an upload image meta wich is returning to you an attachment id, so you can use it with wp_get_attachment_image_src(). You can use the wp_alchemy class if you feel comfortable with programmation and wanted to have an advanced metaboxes, there is an class for the media upload.
    For the post_content it’s tricky to get the attchment id from it url.

    Thread Starter serons

    (@serons)

    Ok. I can look into that. The Media upload window remembers the selected image size, so it’s stored somewhere. How could I pick up this information programmatically, like it’s done in that window?

    Plugin Author Nicolas Juen

    (@rahe)

    Hi,
    If you want to get the available sizes of an image programmatically, you have to get the meta_key _wp_attachment_metadata of an media, then it’s an formal array with the data stored in it.

    Thread Starter serons

    (@serons)

    Very good. Thank you for your kind help.

    Plugin Author Nicolas Juen

    (@rahe)

    No problem 🙂

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘[Plugin: Simple Image Sizes] selected size as featured image’ is closed to new replies.