What about using wp_get_attachment_image_src
?
Using wp_get_attachment_image_src
:
$src = wp_get_attachment_image_src( $img_id, 'thumbnail' );
$src = $src[0]; // Grabs only the URL ($src[1] = width of image, $src[2] = height of image)
Related Posts:
- Change code to display image attachment page
- How To Retrieve An Image Attachment’s Alt Text?
- Programmatically get images by URL and save in uploads folder
- getting attachement images src and add classes
- Check if post has attachments (not image)
- Changing attachment urls?
- Validate alt text for attachments?
- Applying automatic link class to images embedded to posts
- get post attachments of a particular size
- Change image link: wp_get_attachment_link
- Making images from single.php pointing to an attachment .php template
- wp_get_attachment_image_src always returns false
- Exact image sizes
- Change default URL of image attachment
- attachment url rewrite
- Get the size (size in Kb or MB) of an featured image?
- Insert custom ID into wp_get_attachment_link
- query attachment images … if no attachments -> get attachments of parent page?
- Edit default image attachment size
- Attachment 0×0 size error [closed]
- Add image attachment to post via coding?
- How to change image url?
- Link all WordPress images size
- Removing width and height attributes from wp-get-attachment
- Get post attachment images dimension and use in embed code
- use wp_get_attachment_image() to show attachments
- Adding width and height to wp_get_attachment_image_src
- media_sideload_image with rewritten urls?
- Display attachment resolution size
- How to check if there is image title, caption, description?
- How to remove attachments size attribute [duplicate]
- How to redirect ‘file url’ to ‘post url’ i.e. in attachment.php
- Check what attached image size is used
- How do I get all attachments that are used in the current post, not just the children?
- Clean up images, delete unused image sizes attached to a post type
- Get title of post image is attached to
- Correct attachment size
- Post Gallery list attachments except the one used as post thumbnail
- Get image attachment to a post outside the loop?
- How to get image URL from media_sideload_image?
- How do I intercept and modify the functionality of wp_get_attachment_image()?
- Unable to get wp_get_attachment_url to show
- Get Attachment Image Class by attachment id
- Possible to add “Even/Odd Classes” to image attachments via wp_get_attachment_image?
- How to replace post image url before posting using api?
- changing the default picture size link url
- Get an image from the media library. Struggling with the code?
- How to view exact image dimensions of a media in Admin view?
- Filter not applied to all image sizes
- wp_get_attachment_image_src calling wrong location
- Get attachment URL from attachment Link in WordPress
- Display setting ‘size’ not available in image settings modal
- Hide Image Container if No Image Attachments
- Setting name of attachment URL
- Incomplete attachment page
- How to retrieve “custom url” from image attachment in wordpress
- Retreive tags from attached post for media on page
- list of attachments: wp_get_attachment_link works, wp_get_attachment_image does not
- What is the most efficient way to retrieve a group of image URL’s from different attachment ID’s of a specific crop size?
- get_image_tag filter not working
- Change attachment inside the_content using filters
- How to get image title/alt attribute?
- How do I get the avatar URL instead of an HTML IMG tag when using get_avatar?
- How to manage attachment relationships for specific posts in WP 3.5+
- Programmatically adding images to media library
- Can I add a Category Metabox to attachment?
- Creating an Image-Centric Custom Post Type?
- How does WP media uploader create the 3 different sized images, and how can I duplicate it
- Function to get URL of original uploaded image – full size
- how to get original image using wp_get_attachment_image_src
- Can I attach image to post without adding it to post?
- Get the first image from post content (eg.: hotlinked images)
- Change attachment filename
- How to get attachment file name not attachment URL
- How to trigger a refresh in the media modal
- Remove Dimension from wp_get_attachment_image
- Get all post attachments except featured image
- Programmatically adding images to the media library with wp_generate_attachment_metadata randomly fails
- remove links from images using functions.php
- Uploaded images don’t show in Media Library if there are special characters in IPTC Keywords
- How can I bulk delete media and attachments using WP-CLI?
- Disable image attachment links
- How to reference a theme image in a stylesheet?
- wp_get_attachment_image_src and server path
- Getting a taxonomy’s thumbnail url
- How to cleanly delete attachment but retain original file?
- How to add a class to the attachment images
- Add custom class to attachment in media library grid mode
- Are captions stored anywhere?
- Trying to hide buttons from Attachment window
- How to find attachment by it’s name?
- Mixed content warnings after changing site adress from HTTP to HTTPS
- get_the_post_thumbnail() doesn’t taking style attribute
- Find the post an attachment is attached to
- Expanding new Media Uploader in WordPress 3.5
- How can I UN-attach media from a post?
- Uploading Multiple Attachments From Front-End With A Description
- complex restriction of items in media library
- Remove duplicate attachments
- List most recent image uploads, but only for specific custom post type