WordPress.org

Support

Support » Themes and Templates » [Resolved] Get ‘large’ image attachments inside loop? (wp_get_attachment_url)

[Resolved] Get ‘large’ image attachments inside loop? (wp_get_attachment_url)

  • 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.

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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);

    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];
    Austin Passy

    @austyfrosty

    Sweet! Worked like a charm.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Get ‘large’ image attachments inside loop? (wp_get_attachment_url)’ is closed to new replies.