I'm working on my theme and I was able to override the default thumbnail options using this code:
update_option( 'thumbnail_size_w', 320 ); update_option( 'thumbnail_size_h', 180 );
While the thumbnails are now properly sized, sometimes they don't look very nice as they simply crop from the middle.
As such, I would like to be able to make custom crops when this happens. To do so, I go in Media > Library > Click "Edit" below an image > Edit Image
There, I have a panel which allows me to crop the image as I want by clicking the Apply changes to thumbnail option.
However, there are a few issues...
First, it creates a new image instead of overwriting the old one, this pretty much wastes disk space needlessly. Not only that, since the file is entirely new, it seems like the image doesn't get updated on the page (it points to the same filename as before).
This is the code that I use to display the image:
the_post_thumbnail('thumbnail', ['class' => 'featured-post-image']);
Secondly, sometimes I simply can't get a good crop from the image because it's too big. So I scale it down to apply the crop afterward. However, as soon as I scale it down it seems to create a new file again and the library now points to this new image. The old image is still in the folder though and I would rather not create a new image from this scale down and keep the default image as it is.
So I would like to know if this can be done and if this isn't too complex to do through coding, I would really prefer doing so than adding plugins.