Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/units/helpers/image_helper.php
Show First 20 Lines • Show All 117 Lines • ▼ Show 20 Line(s) | |||||
if (!is_numeric($params['max_width'])) { | if (!is_numeric($params['max_width'])) { | ||||
$params['max_width'] = $params['target_width']; | $params['max_width'] = $params['target_width']; | ||||
} | } | ||||
if (!is_numeric($params['max_height'])) { | if (!is_numeric($params['max_height'])) { | ||||
$params['max_height'] = $params['target_height']; | $params['max_height'] = $params['target_height']; | ||||
} | } | ||||
// Optimize, because when cropping from center without resize we'll get same image back. | |||||
if ( !$needs_resize | |||||
&& isset($params['crop_x']) | |||||
&& $params['crop_x'] == 'c' | |||||
&& $params['crop_y'] == 'c' | |||||
) { | |||||
unset($params['crop_x'], $params['crop_y'], $params['fill']); | |||||
} | |||||
$src_path = dirname($src_image); | $src_path = dirname($src_image); | ||||
$transform_keys = Array ('crop_x', 'crop_y', 'fill', 'wm_filename'); | $transform_keys = Array ('crop_x', 'crop_y', 'fill', 'wm_filename'); | ||||
// Resize required OR watermarking required -> change resulting image name ! | // Resize required OR watermarking required -> change resulting image name ! | ||||
if ( $needs_resize || array_intersect(array_keys($params), $transform_keys) ) { | if ( $needs_resize || array_intersect(array_keys($params), $transform_keys) ) { | ||||
// Escape replacement patterns, like "\<number>". | // Escape replacement patterns, like "\<number>". | ||||
$src_path_escaped = preg_replace('/(\\\[\d]+)/', '\\\\\1', $src_path); | $src_path_escaped = preg_replace('/(\\\[\d]+)/', '\\\\\1', $src_path); | ||||
$params_hash = kUtil::crc32(serialize($this->fileHelper->makeRelative($params))); | $params_hash = kUtil::crc32(serialize($this->fileHelper->makeRelative($params))); | ||||
▲ Show 20 Lines • Show All 619 Lines • Show Last 20 Lines |