Hi, I want to create a form for user input where a user can send in images. While WordPress usually creates automatically a set of resized images (idle uploading into the media library) this is not needed in my case.
What is the best way to do so?
If there are any (not found by me) documentation or example page a hint will do it for me...
Thanks and a Happy New Year 2021!
Hello, typically these added image sizes will be generated automatically during the upload process and there is no filter available to bypass that operation easily. It may be practical to delete them programmatically after upload using the Forms API cred_save_data. For example, this post shows how you can get the URLs of all the resized images:
https://wordpress.stackexchange.com/questions/206509/how-to-get-all-featured-image-sizes-and-their-urls/315447
Then you could use custom code to delete those files from the server:
https://www.php.net/manual/en/function.unlink.php
That's the general idea, but it depends to some extent on how these images will be used on the site, and how they are uploaded. For example, are the images stored in a custom field value on some post or in a User profile? Do you plan to display the images on the site somewhere? Will they be stored in the Media Library? Do you just want them uploaded to the server for some other 3rd-party reason, like an image post-processing system?