So I’ve found this WP_Image_Editor in the CodeX. Basically by adding the code below it should automatically resize an image 🙂
Code:
$image = wp_get_image_editor( 'cool_image.jpg' ); // Return an implementation that extends WP_Image_Editor
if ( ! is_wp_error( $image ) ) {
$image->resize( 300, 300, true );
$image->save( 'new_image.jpg' );
}
I don’t know exactly if this will work but I’m sure if you look in the link I’ve gave you then you should be able to find it there.
Best of luck 🙂
Related Posts:
- Removing default image size list in Media Box
- How to reduce original image quality on upload?
- Set spesific size of featured images
- how can I change all wordpress media file url to custom cdn url?
- Zip all (original) images from media gallery
- Add image size if page template
- Set JPEG compression for specific custom image sizes
- remove links from images using functions.php
- Issue with wp_get_attachment_image() and SVG file type
- How do I use the WP image functions in a page template?
- How to use get_template_directory_uri() to load an image that is in a sub-folder of my theme?
- WP 4.4. responsive loads normal image after loading the responsive image
- How to add classes to images based on their categories?
- How to create thumbnails for PDF uploads?
- Is it possible to maintain image aspect ratio when scaling images?
- Auto delete WordPress images/thumbnails (all sizes) and featured after X days/hours, or similar?
- Generating Responsive Background Image Sizes in PHP
- Why are image thumbnails cropped proportionally (not per dimensions)?
- Add custom image sizes to media uploader
- Gallery images titles – get from post
- How to add a rel attribute to images that contains their categories?
- Why are image thumbnails cropped proportionally (not per dimensions)?
- Display height and width properties with the_post_thumbnail() or related function
- Custom image size in Media Dropdown
- Best way to programatically add “rel” attributes to page and post images
- Removing the first image in content
- Function to auto-set a featured image that is already in use
- Actions according to image type and size
- Woocommerce Storefront WordPress Ignore Media Gallery Images and use External 3rd Party Host
- Overwrite Parent Theme add_image_size in Child Theme
- Images uploaded using media uploader are appearing upside down
- How to display more audio file ID3 tags in WordPress
- Count total number of images in post and echo results as number
- How can you limit srcset on a single type of page?
- Can I hide certain upload folders in media library [duplicate]
- Automatically wrap multiple images in div
- Understanding and altering the structure of posted images
- Overwriting Parent Theme’s Image Sizes
- Image rotation fails to regenerate custom sized thumbnail
- Restore Image Title Text
- Twentyten Child Theme: header images display messed up in admin panel
- Automatically assign video ‘poster’ value to ‘filename’ for archive listing
- Disable auto-resizing of uploaded images, but only for certain filename
- Display images that are not in the content
- Can you put a condition on add_image_size() depending on the width of the uploaded image?
- show first 3 thumbnails of posts in different sizes [closed]
- Remove after images
- WordPress converts media extention URL automatically to video player
- Getting custom image size URL in functions
- Can’t generate thumbnail images
- media resize/crop possibilities?
- Control the srcset much more (not all sizes in it each time)
- Way to store featured image width and height in two separate variables?
- srcset and custom field get_post_meta and wp_get_attachment_url
- Visual Composer creating own shortcodes with vc_map() to return simple Image
- What are the meta fields for an attachment?
- Can’t locate custom image sizes defined by child theme
- Woocommerce image sizes missing from Appearance › Customize but not declared by theme
- Add attribute only to first image of every post via functions.php
- Need To Change WordPress Meta Tags… Includes wordpress shortcodes
- Need to convert image url to a Base_64 data url with wordpress function..
- How to Add Shortcode to html img code?
- How to add a new image size and apply it to posts only?
- Function to insert missing image size attributes into img tags
- Use existing image sizes for WooCommerce
- Problem in using Customizer
- Retrieve First Image Function
- Custom Image Size in Insert Media
- Convert all uploaded PNG files to PNG-8 format
- Using add_image_size in functions.php to get original uploaded file
- get_image_tag() html output : empty src attribute
- Facebook OpenGraph error, Call to undefined function wp_get_attachment_src()
- Need To Resize Images Exactly Without Losing Image Details
- Custom image sizes showing in Classic Editor only when upladed directly to post
- Auto delete content in specific folder inside media library
- How to change images url in function.php?
- Put images in the media from url functions
- How to add HTML into error message
- How to update an image attachment’s alt text from a custom field when saving a post?
- Class parameter in get_avatar args doesn’t get added to output
- blank page with wp_get_attachment
- Images with overlay
- Featured image on archive page based on post type
- Printing medium sized image
- Why am I losing image quality on my site?
- Replace image attributes for lazyload plugin on image elements with specific class
- Disable links to images only if link is an image
- No compression occurs on my jpegs after adding jpeg_quality hook to my functions.php file
- Different body image backgrounds on different pages, posts and categories
- Update add_image_size
- Function the_content
- Create input select image URL?
- Dynamically adding Captions to images
- Full size image option removing problem
- Image width issue in IE [closed]
- image_size with respect to aspect ratios
- How to resize image from import image url?
- How to crop image in WordPress with aspect ratio for any size of image
- How to add height and width dimensions automatically to archive descriptions
- How to overwrite image if it already exists – WordPress, Gravity form