You need the generate_filename
method of the image editor class. Like this:
$filename = $img->generate_filename( 'resized', ABSPATH.'wp-content/uploads/resized-images/');
$image->save($filename);
This will save the image, renamed originalname-resized
, in the resized-images
directory of the upload folder. This does not mean WordPress knows it is there. That depends on the context in which you are calling wp_get_image_editor()
.
Related Posts:
- How can I add an image upload field directly to a custom write panel?
- How to implement add_image_size in a plugin
- How to catch images with blank dimensions?
- How to find attachment ID for first image in a post
- Having Problem On Getting WP Post Gallery Images URL
- Set first image (external) as featured image / thumbnail
- Hook event for upload image in the menu
- How to get an image transferred via FTP or script to appear in Media Manager?
- Add media and attach images to pages
- Is there a better way to implement responsive images than what WordPress uses by default?
- Save image as featured image
- How to show large image in checkout page using WP Ecommerce plugin [closed]
- Hook to get image filename when it is uploaded
- Resizing Images for a Gallery-Plugin?
- How to serve different thumbnails/images depending on users browser/platform
- How to Upload Images From a Folder (Not WP_Uploads)
- How to export post meta with images in wordpress
- Get attachments from a post
- Display list of uploaded images, filtered by user under a specific user group
- Upload multiple images and insert them into custom html code
- Which is the better way to store images for the plugin?
- Uploaded attachment not set as featured image
- How do I change the image from the default mysteryman in the WP Profile page
- Hook after attachment added and cropped
- Conditional Generation of Image Sizes using add_image_size
- how to change image of jquery slider plugin
- WP Still Generating 150×150 Thumbnail Size Even After Un-Setting Small Size in Functions.php
- Cleaning a filename after image sideloading a url that contains `%20`
- How to list all images used on a specific page?
- Screenshots on plugin page taken old [closed]
- Resize not resizing images with Capitial extension like JPG
- How to move an image in a plugin to the upload directory and make it as a media of wordpress?
- The URL of images on my website changed after being set as featured image
- Getting incorrect filepath inside custom block front-end output using @wordpress/create-block tutorial
- WordPress Favicon not Working For Images/Videos/PDFs
- Adding the image selector/uploader to an admin back page
- WordPress discards PNG file when uploading plugin file
- Hook for validating and rejecting frontend image upload
- WordPress Iframe for blog image
- Replace the WordPress Media Library Uploader
- Caption Shortcode: what filter to change the image size?
- Filter the_content() to add custom figure tags
- Issue on Getting WP Gallery Items In cpt-single.php As Attachments
- Is it possible to convert various image types from remote URLs to WebP and then serve them immediately?
- Images not displaying on live server
- Using “add_image_size” to register custom image sizes inside plugins not working
- Leveraging Core Functionality in Icon Upload Plugin [closed]
- Displaying an Uploaded Image as a Custom Avatar in WordPress
- Add a custom image source
- Upload to a specific media folder created by FileBird Lite
- Set srcset on a block image
- What are the advantages to the Settings API?
- how to set context in WordPress for unit testing
- WordPress admin deleted user details not removed in database. How to delete WordPress Users from Database
- plugin development: storing language specific options
- Support auto-save and revisions for custom fields
- Gutenberg – What is the best way to save/update post meta?
- Dequeue theme stylesheets but keep widget styling on custom page template
- Save Checkbox value in Plugin [duplicate]
- Using the default wordpress uploader inside plugin
- WordPress after content Hook & external template part
- Alter post object before display
- Failed to Open Stream: Permission Denied While Writing to an XML File in a WordPress Plugin
- Show/Hide ‘add new user’ custom fields in wordpress admin panel by click another field
- Capture mediaelement events
- Email verification for new users
- Insert/Update values to a table after blogname option etc. is updated
- Does admin_print_scripts-$hook_suffix work for nested paths to individual files?
- How to add a widget to the post editing view?
- How to query custom db table?
- Cannot change caption for a plugin
- Remove all removed pages from wordpress
- Invalid hook call on save, not edit when using swiper slider
- Change/Set Page Title and Meta Tags from Page Called within a Plugin
- WooCommerce Endpoints content
- Look for a file in a theme before loading from plugin
- when i activate my plugin i want to auto create pages with shortcodes
- How to display TinyMCE HTML view?
- get the permalink error
- Cannot output plugin twice with shortcode
- Gutenberg – Call google map render function in save after DOM has been rendered
- Does $this context change in an AJAX callback?
- WordPress custom url without using any of the custom tags given
- How to call a plugin function from a page
- If user is logged-in display/hide widgets ( siteorigine) [closed]
- Javascript not being loaded only in custom taxonomy template
- User Registration Moderate
- Implementing Select2 plugin into WordPress
- Object Oriented plugin, add action and variables
- Why user is added back in database after deletion?
- add_action priority and taxonomy used in plugin
- Post data in wp-admin to external database
- redirect word-press page with page values
- How to do searching based on keywords added in page
- How to only Load scripts on variable products page
- Using tag or inline style attribute?
- remove () from category number [closed]
- Call API on post save/update and show the result in admin area
- Is there any other ways to replicating changes on live from staging without pushing from git
- upload image to wordpress media library failed for custom post type