Try using wp_get_attachment_image()
(Codex ref)?
echo wp_get_attachment_image( $attachmentid, $imagesize );
Where $attachmentid
is the attachment ID, and $imagesize
is the name of the image size in the add_image_size()
call.
EDIT
For a custom-field stored image SRC URL, I’m not finding any way to make use of intermediate image sizes defined via add_image_size()
(or even the default image sizes). Pretty much all of the related functions eventually require an attachment ID.
Related Posts:
- get attachment title based on attachment id
- Get Image Description
- Automatically replace original uploaded image with large image size
- Wrong image dimensions in Insert Media after add_image_size()
- PHP Fatal error: Call to undefined function download_url()
- Change WordPress image URLs via filter
- How to resize images in wordpress without adding any compression or changing the color profile of the images, possible?
- hook into completed image upload filter
- Strange img srcset behaviour
- Images uploading to wrong folder
- set_post_thumbnail_size not cropping featured images, but reducing proportionally
- Get URLs for All Sizes of Image via Admin Panel
- Automatically Add Caption in image
- How to Optimize images after uploading all images to WordPress Site?
- How to get relative URL of medium sized featured image?
- Show Post Excerpt in Image Attachement
- WP 3.4 has missing photo data
- What’s the best “insert all images” plugin?
- Image Quality Thumbnail Compression in WordPress?
- Gutenberg editor get post featured image by id
- How to add image id class?
- Local WordPress installation doesn’t crop images
- Get full URL of images in media library including http://
- wp_get_attachment_url with specific image_size?
- Get meta data from image
- Shortcode for a link and thumbnail
- Host images only on CDN
- Fuzzy Images in WordPress 4.4
- In Wordress one author can not see the other’s author uploaded images through media library
- How to add missing dimensions to all images to avoid cls?
- Prevent Image Pasting in RichText Component
- Default Image Link Type Setting not Working
- Fallback for missing srcset images
- max_srcset_image_width doesn’t work as intended
- Background image resets after time (XAMPP)
- Replace image caption with its title and description
- Custom thumbnail size of image when uploaded
- Removing featured image from gallery?
- Is it a good practice to change media settings on theme activation?
- Insert File URL Links to Existing Images that Were Not Originally Linked to Themselves
- Difficulties setting a maximum image width
- Filter for post_thumbnail: link to small src and add data-attribute [duplicate]
- Why does WP allow to view and media item as a page
- How to fix a missing image
- Function to remove all classes on images inserted into posts?
- How to get the real file type for images that do not have an extension
- Images don’t update after being edited
- Cache DB queries result
- Remove “%” from strings in serialized arrays in wp_postmeta
- Images not found after migrating WordPress website
- Adding srcset to an image in ajax
- Error uploading images in wordpress
- Disable Media File Image Link On Mobile Devices
- Set two default featured images
- Automatically generate missing images
- Apply nextgen-gallery lightbox effect [closed]
- VT-resize (great alternative to timthumb) : Errors cropping (litespeed, centos 6.3)
- Allow admin roles to add images to comment replies
- Calling two images at a time? A better way?
- Page speed error: “serve scaled images”
- Image Captions Have a 10px Extra Margin, And It’s Not CSS? [duplicate]
- Image.php Problem – Post Images Not Displaying In It
- View photo album without having to scroll down for each picture
- How can i sorting and display image order by siz in media library?
- x2 images for retina?
- Trouble with Uploading and Displaying Images
- i want to change URL of WordPress image or rewrite in runtime
- Load url image full size in thumbnail, medium, large size
- Non-existent child page URLs redirects to the image attachment URL instead of throwing 404
- WP Large Images crash page
- Images not loading on wordpress.org site
- WordPress can’t detect any thumbnails size?
- Remove image border in twentyeleven theme [closed]
- second featured post not displaying on page [closed]
- How to display posts with images in fullscreen slider
- WordPress not choosing the right image from srcset
- how to remove / hide ‘featured image’ option from side menu
- 403 Forbidden when accessing image in wordpress
- Why doesn’t WordPress make thumbnails for videos?
- For what does WP generate Thumbnails?
- Images are not shown
- Adding multiple images on my site – without using plugins [closed]
- Remove the height limit on wordpress 3.4.2
- Missing Images in Uploads Directory (Server Only)
- > added to images link in WordPress
- Image media upload problem in page editing modus?
- Thumbs and pictures not showing anymore
- Is there a good way to use CMS images with CSS
- Upload image from other server without resize?
- How to access & display images from a post without textual content ( and vice versa) according to best wordpress practices
- Forcing absolute src links in the RSS feed
- where is images/image.jpg?
- Using the on-board image editor for featured images: edits are not being used
- change with CSS the color of an svg background image set with “background-image: url()”
- Img alt tag showing different value then entered
- What type to upload image within theme options?
- WordPress update leads to 404 error on admin page and signup. CSS mishap with all plugin related functions
- WordPress Missing Images
- Display first image’s caption
- The uploaded images are only full-size (original)