• Hi,

    I’m resizing images that are uploaded by users through Gravity Forms. After the form is submitted, I get the image and resize it like so:


    $image = wp_get_image_editor($path);
    if ( ! is_wp_error( $image ) ) {
    $result = $image->resize( 250,250,false );
    $result = $image->save($path);
    }

    This works great in most cases, but sometimes a user might upload an image that is much wider than it is high.

    For example, someone has uploaded an image that originally was 409×104. After the resize, this results in an image that is 250×62. Usually it’s not much of a problem and I can use CSS to fix most cases where this would look off. But it’d be preferable if every image uploaded would end up with the same dimensions. Would that somehow be possible?

  • The topic ‘Resize images to exact dimensions using the WP_Image_Editor class’ is closed to new replies.