This question is not about WordPress, but about PHP. Anyway, if you know the full image name, you know the desired filename has the following structure: imagename-300x*
. This you can feed to the PHP function glob, which will return an array of all files matching the given pattern. So, supposing $image
contains the path to the full image you would do:
$matches = glob ($image . '-300x');
$homef-image = $matches[0];
Related Posts:
- How to upload imagick resource to media in wordpress
- Adding a custom image upload size and making it selected by default?
- How do I get images (with a thumbnail preview) to show in search results?
- What is the alternative to “ when it comes to calling Media (image) files in the ‘attachment.php’ file?
- WordPress automatically adds links to uploaded images
- How to Make Thumbnail of Post Stay Animated
- Convert all uploaded PNG files to PNG-8 format
- How to automatically convert images to WebP on WordPress?
- Generate and upload screenshot as featured image for user-submitted post
- How do I change/modify the_post_thumbnail(); html output?
- What’s the best way to use the Featured Image for responsive web design?
- Uploading media with the REST API
- Decrease file size upload in Media
- Change the filename format of saved featured images
- How to register images uploaded via FTP in media library?
- Failed media upload: “The uploaded file was only partially uploaded.”
- Create Image Uploader for Widget
- Using file_exists to check file in Uploads
- PHP/Manual use of images? – 2 Questions
- Rename image uploads replacing “width” and “height” in filename with “medium”, “large”, “small”
- Rename image uploads with width in filename
- Debugging upload problem: What part of WP does actual image-resizing?
- How to resize image on client-side before upload?
- Adding Featured Image to Post programatically
- Add custom image sizes to media uploader
- Upload images and attachments from frontend form
- WordPress media upload “HTTP error”
- Adding featured image via PHP
- Adding a querystring to an image URL when clicking ‘insert into post’?
- Assign a picture URL to a page via PHP
- How to scale image with equal width and height without distortion?
- is it possible to force wordpress to always save thumbnails as ‘jpg’ not ‘png’
- Validate Uploaded Image using WordPress’ Built-in Functions?
- Get most recent media upload
- Convert all images to PNG on file upload
- How to get media objects
- Echo URL of large version of Featured Image
- Recent posts with featured image or fallback image with permalink
- Set the background to a default image if there isn’t a specified “featured image”
- Can’t upload image using media_sideload_image
- Upload multiple images to a Woocomerce product
- Enable custom logo upload if logo is not in header
- How do I get around “Sorry, this file type is not permitted for security reasons”?
- Redirect to another page using contact form 7? [closed]
- WordPress function when file is uploaded, deleted or edited
- Three Questions with Twenty Eleven theme
- Resize image to specific dimension (X to Y ratio)
- Images Uploaded saving onto older/previous year folders
- Else/If Statement to Display Photo Descriptions
- How to set a featured image (thumbnail) with PHP?
- Convert canvas to image and upload image to server
- Custom upload folder
- WordPress İmages Upload & Delete Error
- Generate responsive post thumbnails of same size
- How to decrease the max file upload size without using php.ini or htaccess?
- Some problems in custom widget
- Checking page before applying image restrictions while uploading
- Hook on file upload
- I can’t set image ad fatured programatically
- WordPress loading all local images from specific directory?
- not outputting medium size image URL
- Replace background image with post thumbnail in shortcode
- Resize post thumbnail
- wp_delete_attachment not working with multiple values
- add class to background image
- Save the outputted image into the Media Library, with a different filename and extension
- How to resize an image server-side before upload?
- Name Input from widget displays Sidebar name instead of saved data
- Can’t upload files
- Setting post thumbnail sizes in template file and functions.php
- Edit Image/Image Details – Replace button missing
- add if statement to the featured image
- An automatic way to crop images of different sizes
- Remove default Image Sizes
- How to add a class to the attachment images
- How to change the naming of the resized image files
- Use Filename for Alt and Title Tags
- How to enlarge the media file upload size in wordpress admin
- I need a Simple image uploader with a simple screen. WP default has too many options.
- fallback image for featured image
- Change logo based on incoming domain
- wp_handle_upload – The uploaded file could not be moved to wp-content/uploads/2012/09
- Auto crop images in WordPress
- Bulk edit of EXIF data for jpeg images uploaded in the media library?
- Can’t generate thumbnail images
- Change wp-content/uploads to uploads/%postname%/%image%
- “imagejpeg” function is not working in wordpress
- Need to add a post’s featured image to a section on the frontpage
- WordPress Multisite: Images moved to /sites/1?
- Attaching an upload to a user
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- Is custom behaviour possible when asynchronously uploading?
- Theme stops media uploader from working
- featured post as div background
- How to display thumbnail if post is assigned one otherwise not
- Determine if only one image attached to a post/page
- upload images on front by user using form
- Adding slides to an existing carousel manually
- Why some images are not allowed to be edited only for thumbnails?
- WordPress directories not writable after PHP version upgrade