• If you visit https://socialmediatutorials.co.uk/ and wait for the second featured image to show, you’ll see that it doesn’t quite fit the width of the box it has to. This image is pulled automatically from the YouTube video via some editing in the functions.php file. There is an add_image_size(‘featured-image’, 516, 340, true); to set the size of the featured image to fit the box, but the original image taken from the YouTube video is smaller than the width I need.

    WP doesn’t allow for upscaling of images by default. I’ve read up on it and apparently this should have changed it:

    wp-includes/media.php
    Line 349/350 to:
    $new_w = $dest_w; min($dest_w, $orig_w);
    $new_h = $dest_h; min($dest_h, $orig_h);

    But this didn’t work. I can’t really find anything else on the subject and apart from doing it manually (which would be the biggest pain) I’m not sure what other options I have?

    Any help would be amazing.
    Thanks.

Viewing 1 replies (of 1 total)
  • I’m not sure that what you want to do is possible or not, but whatever you do, do not hack WP core files. YOU SHOULD NEVER HACK CORE, no matter what.

Viewing 1 replies (of 1 total)
  • The topic ‘Allowing WP to upscale images’ is closed to new replies.