WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Get 'large' image attachments inside loop? (wp_get_attachment_url) (4 posts)

  1. 3stripe
    Member
    Posted 5 years ago #

    Hello,

    I can't work out how to pull the 'large'-sized version of an image into the loop? This doesn't seem to be documented anywhere...

    At the moment I'm using $large=wp_get_attachment_url($num); but this returns the path to the original, fullsize image, whereas I want the one sized to 1024px in either dimension.

    Thanks for reading.

  2. 3stripe
    Member
    Posted 5 years ago #

    Well, I'm not sure if there's a better way, but this worked :)

    $image=wp_get_attachment_image($num, 'large', false);
    $imagepieces = explode(" ", $image);
    $imagepath = substr($imagepieces[1],4);
  3. 3stripe
    Member
    Posted 5 years ago #

    In fact this is even cleaner, thanks to my buddies on Yay:

    $image=wp_get_attachment_image($num, 'large', false);
    $imagepieces = explode('"', $image);
    $imagepath = $imagepieces[1];
  4. Austin Passy
    Member
    Posted 4 years ago #

    Sweet! Worked like a charm.

Topic Closed

This topic has been closed to new replies.

About this Topic