WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] get attachment image of edited/scaled size (4 posts)

  1. chodorowicz
    Member
    Posted 3 years ago #

    Hey!
    Do You know how to get the url of an image attachment, but not the original one but the edited/scaled/cropped version? When I use this function I get all the time the original version and codex doesn't tell how to get the version after edits

    Thanks in advance for help

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    codex doesn't tell how to get the version after edits

    Oh yes it does!

    <?php wp_get_attachment_image_src( $attachment_id, $size, $icon ); ?>

    $size
    (string/array) (optional) Size of the image shown for an image attachment: either a string keyword (thumbnail, medium, large or full) or a 2-item array representing width and height in pixels, e.g. array(32,32). As of Version 2.5, this parameter does not affect the size of media icons, which are always shown at their original size.

    Default: thumbnail

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

  3. chodorowicz
    Member
    Posted 3 years ago #

    But as I mentioned in my post I'm not interested in any of these 4 sizes ("thumbnail, medium, large or full") - I need the url to the image which is created after users edits image using the "Edit Image" functionality introduced in WP 2.9

    After you use this functionality a 5th file is created in Upload folders (5th after original file and three standard sizes) and I need url to this 5th image

  4. chodorowicz
    Member
    Posted 3 years ago #

    OK, kind of "my bad" - when I use the "the full option:
    $src = wp_get_attachment_image_src( $result->ID, 'full');
    I get the url which I need
    Problem solved. Thanks for guiding me through!
    Greetings

Topic Closed

This topic has been closed to new replies.

About this Topic