WordPress.org

Forums

Simple Image Sizes
[resolved] selected size as featured image (12 posts)

  1. serons
    Member
    Posted 2 years ago #

    Is it possible to make the featured image have the selected size? Whichever size I select the featured image always gets the original size.

    http://wordpress.org/extend/plugins/simple-image-sizes/

  2. Rahe
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  3. serons
    Member
    Posted 2 years ago #

    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?

  4. Rahe
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  5. serons
    Member
    Posted 2 years ago #

    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?

  6. Rahe
    Member
    Plugin Author

    Posted 2 years ago #

    From the post content ?

  7. serons
    Member
    Posted 2 years ago #

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

  8. Rahe
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  9. serons
    Member
    Posted 2 years ago #

    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?

  10. Rahe
    Member
    Plugin Author

    Posted 2 years ago #

    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.

  11. serons
    Member
    Posted 2 years ago #

    Very good. Thank you for your kind help.

  12. Rahe
    Member
    Plugin Author

    Posted 2 years ago #

    No problem :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Simple Image Sizes
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic