Example #1
0
File: i.php Project: donseba/Piwigo
if (0 != $page['rotation_angle']) {
    $image->rotate($page['rotation_angle']);
    $changes++;
    $timing['rotate'] = time_step($step);
}
// Crop & scale
$o_size = $d_size = array($image->get_width(), $image->get_height());
$params->sizing->compute($o_size, $page['coi'], $crop_rect, $scaled_size);
if ($crop_rect) {
    $changes++;
    $image->crop($crop_rect->width(), $crop_rect->height(), $crop_rect->l, $crop_rect->t);
    $timing['crop'] = time_step($step);
}
if ($scaled_size) {
    $changes++;
    $image->resize($scaled_size[0], $scaled_size[1]);
    $d_size = $scaled_size;
    $timing['scale'] = time_step($step);
}
if ($params->sharpen) {
    $changes += $image->sharpen($params->sharpen);
    $timing['sharpen'] = time_step($step);
}
if ($params->will_watermark($d_size)) {
    $wm = ImageStdParams::get_watermark();
    $wm_image = new pwg_image(PHPWG_ROOT_PATH . $wm->file);
    $wm_size = array($wm_image->get_width(), $wm_image->get_height());
    if ($d_size[0] < $wm_size[0] or $d_size[1] < $wm_size[1]) {
        $wm_scaling_params = SizingParams::classic($d_size[0], $d_size[1]);
        $wm_scaling_params->compute($wm_size, null, $tmp, $wm_scaled_size);
        $wm_size = $wm_scaled_size;