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 to upload multiple images to use as gallery in Kirki Framework
- How do I display a PDF thumbnail as a link to the PDF without uploading the image
- Featured Image add tab
- Hide media for non logged in users
- Displaying images outside the content
- Serving Images from subdomain in wordpress
- Change image data durgin upload
- Need to add a post’s featured image to a section on the frontpage
- Problem with inserting multiple images in gallery of each WooCommerce product programmatically
- Generate images with html2canvas and the woocommerce api
- Change extension to .jpg when webp is not supported
- WordPress api post image raw data without being blank in media library
- User uploads image as “Featured Image” but WordPress resizes it?
- How can I update WordPress plugins or WordPress itself in all server?
- Profile image does not upload
- Prepend to all image URLs with PHP, only for mobile devices
- Retrieve alt text by referencing the img src
- Show next image in array if page is revisited by same logged user
- WordPress append -1 to the image name
- async upload not working when not logged
- Add Featured Image to Existing Post
- wp_query – Exclude the first thumbnail from lazy loading on archives
- cant upload media/pictures to my wordpress site, cant upload anything to my database
- unable to write to the database while uploading images
- Change the URL of an image from wp_get_attachment_image_src for Product Posts based on Category