I have added a new image size to a wordpress site with lots of images already present with all their thumbnails.
Is there a way to do this: given the post using a specific image, get the attachment image and generate the thumbnail of the new size?
I'm looking for a way to do this when needed and only on specific selected posts (it's an image size only used for some posts placed in a "highlighted news" box), so no generic plugins which scan the whole 8gb directory of images, but I'd like to use wordpress tools (basically what it does when you upload an image and all thumbs are generated) instead of doing it all by hand.
I will clarify the scenario so that it's more understandable. I have a simple admin tab where the user enters the URLs of the posts that go in a specific highlight box in the homepage. It all works perfectly, except for the images.
What I want to do is this: whenever an URL is entered in that admin panel the image attached to that post must be processed to create a new thumbnail with the recently added image size (since it's a new size, all images predating it do not have the relative thumbnail). This should be an automatic process, otherwise the user has to go to the media library, find the correct image and regenerate its thumbnail, thus losing the simplicity of the original idea.
Basically I'm looking for something like:
wp_generate_thumb($attachment_id, $image_size); // EXAMPLE, function not really existing
which should just accept the attachment id and the string of the image size defined with
add_image_size() and take care of everything else.
The closest I found is this
wp_get_image_editor() which doesn't really seem to do what I need.