Home > database >  WordPress how to automatically resize uploading all images and delete original of image on server?
WordPress how to automatically resize uploading all images and delete original of image on server?

Time:04-19

I want to all images that will be stored on server to be maximum 900px width.

Example: User uploads image with 3500px by 3500px, i need it auto resize for 900px and then delete original 3500px image from server. Thanks

CodePudding user response:

To generate different sizes of images, you can add custom thumbnails that will be created when an image is uploaded. You can achieve this with a couple of lines of code in functions.php:

https://developer.wordpress.org/reference/functions/add_theme_support/

I'm not sure deleting the original is possible, as it's linked with the different thumbnails that are generated. A couple of tweaks in your template do however ensure the original isn't used.

  • Related