The URL for rezied images in WordPress is constructed in a way that’s impossible to direct reverse. Therefore, it’s impossible to get the attachment associated with a URL of a resized image with 100% certainty, unless you loop through all attachments and check whether their URL matches the given URL. However, this approach is very slow and resource-intensive.
In any normal WordPress setup, you can rest assured that, given a URL of a resized image, you can retrieve the full image URL by removing the dimensions from the URL. This is, however strange it may seem, best practice.
Related Posts:
- remove or update add_image_size
- get the attachement url for the medium sized image
- Each custom image size in custom upload directory?
- Is there a simple way to just insert a link to an image (without inserting an image)?
- Watermarking Images with WordPress with WP_Image_Editor
- Get attachment/image info in JS
- Auto-modifying original [full size] images
- Get attachment ID of author_meta image – Attachment Metadata
- Black and White thumbnails
- Crop image to horizontal or vertical by code based on image size
- Alter image output in content
- How can I remove the image attachment ALT field?
- Open the attachment details modal
- Download button for Featured Image in every post – automatically
- Change html structure of all img tags in WordPress
- Get a list of all image sizes that match aspect ratio of original one
- Randomly add a ‘ul’ list of images
- Can’t access ‘Store uploads in this folder’
- How to Display Featured Image Title and ALT Attribute
- Is it possible to recover featured images after WordPress export/import
- Thumbnails are bigger in size than the original image
- The the post id from image id
- Add attribute to caption shortcode from custom attachment field
- Get an image’s alt text in a shortcode using the image URL
- Add Small Image Size to Media Settings
- Image resize depending on orientation?
- Character Limit w/ Excerpt removes Images Why?
- Featured images not displaying at full resolution
- Check if the image exists in WordPress media library
- Adding new size for Media screen in functions.php not working
- After installing ssl certificate images won’t show
- Faster way to put images into a blog post by using Add Media dialog
- WordPress adds extra width to post images container boxes
- Handling image uploads without thickbox
- Retrieve an array of image URLs that belong to a gallery
- Help With Custom Image and Text Widget
- Using SRCSET with Images and Featured Images
- Images uploaded to the media library has strange colors. However, in the edit screen the color is ok
- wordpress post pagination with image buttons?
- How can I change get_the_post_thumbnail to make 100% width image?
- Native gallery sorting is ignored
- Disable lazy loading on specific images
- Using Jetpack carousel w/o creating a gallery [closed]
- Bulk Upload Image Alt Text
- Custom responsive ‘featured image’ sizes
- removing the featured image from the post
- Dynamic image crop in WP 3.0+?
- What can i do add title to ‘large’ image?
- Height and width attribute not setting by the_post_thumbnail
- NextGEN Conditional Statement [closed]
- How to set minimum required size for featured image?
- All Images not calling alt text
- Can we use featured image as third party website image URL
- Whats causing image quality to be degraded?
- Exclude image url from search query
- Inserting image into post with different image size
- limit number of images shown from gallery
- Alter the image used for a user who has not uploaded a custom image yet
- Allow users to upload multiple images to their profile
- how to change format jpg to webp?
- Allow a specific user role I have created to only upload one image to his media library
- Implementing a modal(lightbox) for all images in all post-gallery posts
- how to regenerate webp et-pb-portfolio-image
- How to increase media image scale limit?
- How do I avoid color distortion of uploaded images?
- Where to put code that customizes API
- Force WordPress to always generate a thumbnail for original image
- When upload a PNG a noise appears in the thumbnails
- How to auto add image caption from image alt?
- File upload size limit in wordpress and php.ini limit
- How to add php to theme to show alt attributes
- Display Title/Description/Caption of custom images on homepage
- Blank image thumbnails in media library
- Getting extra image links in code with wp_get_attachment_image
- Get “Image CSS Class” value from the Advanced Options section
- After reinstalling wordpress images do not appear in posts?
- Dinamically modifying attributes of images on posts
- Run command to optimize images after they get uploaded to WordPress
- How decrease the size of images which are present in uploads folder?
- Show images from TEXT section on PAGE wordpress
- Where to add my code to auto attach images to existing products
- Large size is not honoured when inserting image
- If file exists with page slug name show image else nothing
- Issue uploading images
- How can I use images that are on the server locally?
- Image filter works on attachement pages but not posts. I can’t get the image ID
- The most of the images don’t appear, although URLs are correct
- Get images uploaded to this post in popup on editor screen
- Remove “align” attribute on images
- Paginate Gallery [closed]
- How do I add a nested conditional within an echo – to use a default image if there isn’t one in the post?
- WordPress: Preload next post images
- How do I change a Themes Header Image?
- Some images 404
- Blurry Images WordPress 5.8.1
- Why is inline CSS added to images automatically? [closed]
- How to show file size of featured image? [duplicate]
- How to import external media items into wordpress media library (without using storage)
- How to return responsive images from a sanitize_callback?
- How to disable Right Click on a image? [closed]