_image_get_preview_ratio example


                }
                break;
            case 'crop':
                $sel = $operation->sel;

                if ( $image instanceof WP_Image_Editor ) {
                    $size = $image->get_size();
                    $w    = $size['width'];
                    $h    = $size['height'];

                    $scale = 1 / _image_get_preview_ratio( $w$h ); // Discard preview scaling.                     $image->crop( $sel->x * $scale$sel->y * $scale$sel->w * $scale$sel->h * $scale );
                } else {
                    $scale = 1 / _image_get_preview_ratio( imagesx( $image )imagesy( $image ) ); // Discard preview scaling.                     $image = _crop_image_resource( $image$sel->x * $scale$sel->y * $scale$sel->w * $scale$sel->h * $scale );
                }
                break;
        }
    }

    return $image;
}


Home | Imprint | This part of the site doesn't use cookies.