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
- Restricting Image Upload Sizes using ‘wp_handle_upload_prefilter’ – Stuck media progress bar when Featured Image?
- 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 do I display a PDF thumbnail as a link to the PDF without uploading the image
- Featured Image add tab
- How do I hook into WordPress to save an uploaded photo as an alternate size to an existing photo?
- How to check if image is already stored in a site’s post database? (network)
- Permanently remove first image from posts
- upload featured image from front end using wordpress add media button
- Is it unsafe to put php in the /wp-content/uploads directory?
- How to use SRCSET with get_the_post_thumbnail()?
- Using wp_get_image_editor in a standalone script
- How to get Poster (thumbnail) Image of Video
- Styling images coming from another blog
- How can I receive the image id using the media box?
- IMG src weird behaviour inside a single post loop
- add_image_size() and uploading the exact size leaves 1×1 image in uploads
- PHP code to call image Caption, Alternative Text, and Decription?
- Randomly Assign an Image’s Alt Text Based on Data From Post
- Best practice for migration friendly images in posts/pages?
- Media Gallery Upload photo incorrect way like glitch
- How to make own crop image function for WordPress plugin
- How to set uploaded image as featured image wordpress
- Cropping thumbnails to specific dimensions on front end post
- How to link featured images in single.php for only non-logged-in users?
- Crop an image after upload on custom account page
- Restrict File Type Uploads by User on Wordress via functions.php
- WordPress pointing animated GIF images with wrong file name upon upload (GIFs animation not working)