_crop_image_resource example

$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;
}


/** * Streams image in post to browser, along with enqueued changes * in `$_REQUEST['history']`. * * @since 2.9.0 * * @param int $post_id Attachment post ID. * @return bool True on success, false on failure. */
Home | Imprint | This part of the site doesn't use cookies.