Support » Plugins and Hacks » Hacks » Get available image sizes using attachment id
3 years, 6 months ago
I have been trying to write a function that adds links to available image sizes below each inserted image in a post.
I know there is a function get_intermediate_image_sizes but it works only within a Loop for attachment pages.
I need a function that allows me to fetch available image sizes using image id as argument. Can anyone suggest a way out?
Try wp_get_attachment_image_src(). You’ll have to call it for each registered size, which is easily done with an array of sizes feeding a foreach loop. Otherwise it returns everything you need.
Thanks buddy. I tried. works perfect 🙂