WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Getting medium sized images (2 posts)

  1. RogerUsh
    Member
    Posted 1 year ago #

    I read through the codex for these 2 functions:

    wp_get_attachment_image

    http://codex.wordpress.org/Function_Reference/wp_get_attachment_image

    wp_get_attachment_image_src

    http://codex.wordpress.org/Function_Reference/wp_get_attachment_image_src

    But when I try to run it specifying an image size it still returns the full sized image.

    $image_attributes = wp_get_attachment_image_src( $post_id, 'medium' );

    On the codex page under the $size definition for both functions say:

    "As of Version 2.5, this parameter does not affect the size of media icons, which are always shown at their original size."

    Alternatively I've tried get_the_post_thumbnail and image_downsize with no luck.

    Essentially I have the $post_id for the attachment and I want to extract the url for the medium sized image.

  2. RogerUsh
    Member
    Posted 1 year ago #

    I am using the plugin Automatic Featured Image Posts and I was trying to insert the medium sized image source into my posts through the plugin functions, but it ended up easier to display the medium sized thumbnail image in my theme template instead using:

    the_post_thumbnail('medium');

    I found this thread on the plugin helpful:

    http://wordpress.org/support/topic/plugin-automatic-featured-image-posts-add-image-to-body-of-post-as-well-as-adding-featured-image

Topic Closed

This topic has been closed to new replies.

About this Topic