I'm trying to ensure that all assets are the same size, no matter what resolution they are uploaded in. I'm stuck finding outdated info on the matter, I think.
I've gotten to the following snippet
if( get_the_post_thumbnail_url()){
$image = wp_get_image_editor(get_the_post_thumbnail_url());
if ( !is_wp_error( $image )){
$image->resize( 300, 300, true );
$image->save("image.jpg");
}
}
Which seems to work, but I have no idea how I get the resized URL (or insert it properly). As I want to add it to my page. Something like
echo '<img src=" . $image.url() . ">";
Is what I'm thinking of. Am I going about this wrong, or how should I continue from here?
Thanks!