Get the attachment ID for the image, then get the post meta field _wp_attachment_metadata
for it. This is a serialized array. The field sizes
in that array contains all available image sizes.
Pseudo-code:
$sizes = array();
$attachment_url="http://examle.com/wp-content-uploads/foo.png";
$attachment_dir = dirname( $attachment_url );
$attachment_id = get_attachment_id( $attachment_url );
$attachment_meta = get_post_meta( $attachment_id, '_wp_attachment_metadata', TRUE );
$sizes[] = $attachment_url; // main file
if ( ! empty ( $attachment_meta[ 'sizes' ] ) )
{
foreach ( $attachment_meta[ 'sizes' ] as $size )
$sizes[] = "$attachment_dir/" . $size[ 'file' ];
}
Related Posts:
- Programmatically adding images to media library
- Programmatically get images by URL and save in uploads folder
- how to get original image using wp_get_attachment_image_src
- Can I attach image to post without adding it to post?
- Uploaded images don’t show in Media Library if there are special characters in IPTC Keywords
- wp_get_attachment_image_src and server path
- How to find attachment by it’s name?
- How do I delete all generated images from my server except those currently used in posts
- Insert an image into a post by API
- Function to call the attachment image from post
- Theme Customiser Image Control
- How can I hide media library images from general users?
- Get attachment ID of author_meta image – Attachment Metadata
- Associate an existing image with a post
- Get Attachment ID from URL [duplicate]
- How to remove title attribute from gallery links and images
- Separate attachment images from post loop
- How to display a shortcode caption somewhere other than the_content
- copy attachment title to description and alt text
- Get an image from url in front end submission form
- Open the attachment details modal
- How to upload image without post ID using the new media uploader?
- How do I delete thousands of unattached images?
- Allowing post attachments without allowing to insert in text
- Rename attachments during upload
- Regex to turn embedded images in to attachments
- Re-process Images
- Show prev and next post links for parent post of current image in attachment page?
- Regenerate missing _wp_attachment_metadata
- Make alt text required when setting a featured image
- Display one random image, but only if landscape
- get_attachment_id() only get id of first attached image after post update
- Why can I not view image attachment pages?
- Is there a way to get attachment data?
- How to change image url?
- Custom page template to display all image attachments
- Link to full size image or attachment page in photo theme
- get the image of the post
- add the post as canonical for attachment page wordpress
- media_sideload_image with rewritten urls?
- Out of memory error reporting
- How can I attach hotlinked images in posts/pages within the same server?
- Multiple images in one attachment page
- WordPress Image Attachment using remote image
- Exclude images from “inserted into post” when trying to get attachments
- WordPress adds extra width to post images container boxes
- Handling image uploads without thickbox
- Pull images from the gallery
- Customizing the attachement page to show rest of all images in a gallery from post
- Auto delete attachments that are older than x days
- Images attached to posts from library link to 404 error page
- Help to upload post attachments from Ajax
- Replacing the content of an image attachment using API
- Rewrite all article pictures to link to file
- Call to undefined function wp_generate_attachment_metadata()
- How do you import images from a URL in your post?
- Get images attached to a specific page
- Retrieve Image Attachments Getting Post Thumbnail Image First
- WordPress Creates Unused (Unregistered) Image Sizes
- One picture belonging different galleries?
- WordPress Attachments with old images
- How to get image URL from media_sideload_image?
- How to test if there are no more previous or next image on attachment page?
- Show last 12 uploaded images on home page, but only from posts
- What is the best way to associate multiple images to one page?
- Random Characters in the end of every image url in post
- Excluding post thumbnail from the attachment.php when using wordpress gallery
- How to replace post image url before posting using api?
- How to get post id of first child of the same post type?
- Output posts attached images as thumbnails linked to full-size with lightbox class
- Can i have 2 separate Galleries on 2 separate pages each go to a DIFFERENT Attachment.php file?
- Attachments without images
- Custom image size not displaying with wp_get_attachment_image()
- wp_insert_attachment() dupplicate attachment posts
- How to echo images Urls from a wordpress post, that are relally in the post
- SQL: How to find all attachments that are not used in any posts/pages/custom_post_types
- Allow users to upload attachments to certain posts
- Get “Image CSS Class” value from the Advanced Options section
- Uploaded images not showing properly using wordpress
- How can I add an “Attach image to this post/page” link on the Add Media lightbox?
- Troubles with code for upload a image
- After I upload a file to library its name converted to dashes
- attachment.php & flexslider—linking thumbnail to specific image
- Create a custom attachment thumbnail for quick page load
- Surround uploaded image link with div
- Setting name of attachment URL
- How can I hide previous_image_link() on first attachment page?
- Show title when inserting single images
- Upload unnattached image from frontend
- Image attachement management – a philosophical question
- wp_get_attachment_link() add rel attribute if the link points to direct image
- greater flexibility in targeting images attached to page
- Stop Attachment image names from taking top level permalink
- How to access & display images from a post without textual content ( and vice versa) according to best wordpress practices
- How can we see which posts don’t have a featured image or it doesn’t exist anymore?
- Image Attachments Query Not Working If Post Is Loaded Via Ajax
- How can I use an image from an external source without uploading it to the media library
- How to get WordPress to resize images for srcset?
- Remove one srcset entry from wp_get_attachment_image
- Attachment tag archive