I have added an image size
<?php add_image_size( 'test', 300, 300, true ); ?>
Uploaded an image of exactly 300 x 300px,
Then got the image
<?php wp_get_attachment_image_src( $id, array(300,300) );?>
or
<?php wp_get_attachment_image_src( $id, 'test' );?>
Works both ways. Maybe you did not define the image size correctly in functions.php
Related Posts:
- How to generate thumbnails when needed only?
- No Thumbnails Generated
- How to Require a Minimum Image Dimension for Uploading?
- How does WP media uploader create the 3 different sized images, and how can I duplicate it
- Reject upload of wrong-sized images using the Media Uploader
- Create image formats with different qualities when uploading
- Which filters or actions to use after a media upload and delete?
- PNG with transparent background turns black when uploaded and resized
- Settings in ‘Media > Settings’ is ignored when inserting images
- There’s a way to scale media (images) at 50%?
- How to prevent upload of a multiple sizes of images
- How can I prevent uploading bmp image?
- Impose a Maximum Limit on Image height and width upload size
- Force wordpress to see uploads folder media
- Convert uploaded PNG to JPEG automatically
- add_image_size creating lots of images (of various sizes)
- resize images not crop
- Add suffix to filename of uploaded images
- How to link to the image editor’s Edit Image function?
- Regenerate thumbnails after upload
- Front-end Image Upload with Preview – Is this Possible in WP?
- WordPress won’t generate image sizes for certain images
- Thumbnails produce unwanted gray pixels on white background [closed]
- Site icons with alpha channel for self-hosted WordPress blog network
- How can I receive the image id using the media box?
- Can I stop wordpress generating media sizes
- add_image_size() and uploading the exact size leaves 1×1 image in uploads
- WordPress Fancybox Resize Large Image
- Error uploading images (but the images are at the server!)
- How to generate thumbnails when needed only?
- WordPress Media Library showing wrong preview size?
- Original image not saving?
- Process uploads with phpThumb before generating thumbnails
- Resize existing library images
- Large image upload size (using timthumb.php
- Image resizing – TimThumb vs convert on upload?
- WordPress Bug on IIS ? Problem when uploading image on IIS 7
- When does WP resize an image file
- Stop image resizing in particular case – is that possible?
- Issue with images which have no sizes available
- How to resize attachement
- Best way to receive special images in posts
- Resize uploaded original images to a minimum automatically
- Dynamically determine the width and height of a image file to be cropped & uploaded AFTER form submission given fixed aspect ratio
- Control resizing of uploaded images
- Images uploaded via Gutenberg image block are cropped
- Set default “Link CSS Class” in add media admin editor
- Images not aligning correctly
- Redimension thumbnail crop without creating new images
- get the post thumbnail returns the full size
- WordPress Image Resize fails without Error Message
- How to force attachment size for every post
- Image upload callback in new 3.5 media
- How to wp_upload_bits() to a sub-folder?
- Is it possible to trigger some JavaScript when Media Popup is opened?
- Media Uploader: get deleted files
- Add file extension to temporary file
- Why “Store uploads in this folder” option is not showing in Media Settings in WordPress
- limit amount of photos uploaded per cpt post
- How to add a media with PHP
- Allowing .exe uploads (old WPSE posts no longer work)
- Prevent renaming of uploaded media
- Is it safe to delete uploaded photos if Photon (Jetpack) is activated?
- How do I get allowed Media Library upload file extension list?
- Use the WP media uploader dialog for uploading a form attachment (non-admin). Offering progress and drag and drop feedback
- using wp_insert_attachment() results in guids with file names different to the same file when uploaded via media page in admin
- Separate Uploads folder on other server
- How to disable plupload completely from latest wordpress 3.6 and make browser upload default
- Create custom fields as image uploads [duplicate]
- Use custom image size in admin panel
- Receiving 404 when uploading file larger than 10kb
- Show image crop window on image upload
- making media URL secured
- frontend image post uploader
- WYSIWYG editor with image upload for “Normal Users” [closed]
- Easing the download of a regularly uploaded pdf
- Get all images in uploads directory and list them
- Upload media only to DB
- Is it possible to import all files from a uploads DIR into WP media, retaining paths to the files
- Is there a way in WordPress to convert images to WebP without a plugin?
- Offload Media Library to other domain on a different server
- Embed HTML5 files/subfolders in post?
- How to change archieve frequency of the media file in uploads folder for wordpress blog
- How can i identify media uploaded to my website that is not being used anywhere anymore?
- image URL changed in wordpress
- Insert attachments from custom uploader into post (regular uploader style)
- Images not uploading on product page of woocommercr
- How to download CSV from sub directory in uploads folder
- Upload multiple files
- media_handle_upload() with 1 image under 1Mb chokes my server and returns timeout error
- Updated wordpress missing image upload area
- Sanitizing existing media library paths and page links from foreign characters
- How could you allow users to upload a video in within their profile and display it on a wordpress site?
- restrict uploaded image size and fixed image display size
- Limit attachment caption characters
- WAMP install acts different than live install when uploading images
- Password protected uploaded PDF page
- How can I hook and edit on the fly an image uploaded
- Unable to upload images using the Media Library
- Uploading media to wordpress API with C# HttpClient