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
- Plugin directory “Last Updated” not changed after initial commit?
- What is the recommended way to create plugin administration forms?
- Fatal error: Call to undefined function wp_mail()
- Does WordPress have an Browser Agent?
- How Do I Load My Action Earlier Enough?
- I can’t find where a hook is being defined in a plugin – Easy Digital Downloads
- Filter on the_content ignores shortcodes
- Custom theme sufficient or custom plugin neccessary for this feature set?
- Database for development
- PHP library that can merge stylesheet with inline style [closed]
- How to disable reCaptcha v3 except on Contact Form 7 pages?
- How to get color name in PanelColorSettings in custom Gutenberg block?
- Fetching the value of forms in WordPress AJAX
- Cannot redeclare function error on the same line
- Append country to ‘pretty’ url but serve same page
- Insert terms for custom taxonomy on plugin activation, or each page load (init hook)
- Adding a brand column to WooCommerce Products
- Custom GET Parameters In Plugin’s Admin Page
- Adding option to Gallery shortcode
- WordPress Search filter to remove possible script injections
- Mixing and Matching – Custom templates in a WordPress plugin
- Open Graph Object Debugger & url parameters – Page Not Found result
- How Can I add Fields in wp-option table?
- Where do I put my add_action(… and add_filter(… and do I need to remove them?
- Can’t find where to modify attrbitutes
- ajax recursive calls on wordpress returning answers outsite the function scope
- Add Password Generator on password protected page
- WordPress pages are not published due to External database connection with WPDB class
- How to optimize multiple insert into wordpress database
- How to add custom options for plugin into the add post screen – like yoast seo
- How to find where an object first instantiatiation
- Clean way to initialize plugin in newly-added site when plugin has been network activated?
- Get coordinates of selected area to use in image maps [closed]
- Can I attach a plugin via my add_filter callback contents?
- How to trigger selected option from a clic. (variation product woocommerce)
- Show username only if logged in in a else no directly name
- Yoast and another plugin
- Headers already sent on custom plugin (Export function)
- Handle changed Woocommerce function
- Making Woocommerce optimized for more than 500k products
- wp_enqueue_style don’t register all google fonts
- Add placeholder into contact form 7 recaptcha text field
- To remove rendering of menus and header, plugin or theme?
- Adding a custom button to WordPress Add Post (and Edit Post too) screen, that can save the post
- How to display custom taxonomy and terms using/creating plugin template
- mysql_real_escape_string() error using xml2ary in WordPress plugin
- Modify a Themes Appearance >> Header admin screen from a plugin
- How to create a database table in WordPress using PHP
- Plugin Internationalisation and textdomain