This question already has an answer here:
My aim is to upload an image and completely replace the original source image with a custom image size, as if the custom image sized file was the uploaded image.
For example, I have custom image size
wpse, and I want to replace the original image completely with this file upon upload.
How is this possible?
Potential approach could be to hook into the upload process, edit the
guid key in the
wp_posts table with the URL of the
wpse image, then delete the source uploaded file. I'm sure there are other values which needs to be updated.