Index: branches/RC/core/units/general/helpers/image_helper.php =================================================================== diff -u -N -r10638 -r11305 --- branches/RC/core/units/general/helpers/image_helper.php (.../image_helper.php) (revision 10638) +++ branches/RC/core/units/general/helpers/image_helper.php (.../image_helper.php) (revision 11305) @@ -10,6 +10,8 @@ */ function parseFormat($format) { + $res = Array (); + $format_parts = explode(';', $format); foreach ($format_parts as $format_part) { if (preg_match('/resize:(\d*)x(\d*)/', $format_part, $regs)) { @@ -21,6 +23,9 @@ $res['h_margin'] = $regs[2]; $res['v_margin'] = $regs[3]; } + elseif ($format_part == 'img_size' || $format_part == 'img_sizes') { + $res['image_size'] = true; + } } return $res; @@ -36,12 +41,20 @@ */ function ResizeImage($src_image, $max_width, $max_height = null) { + $image_size = false; + if(isset($max_height)) { $params['max_height'] = $max_height; $params['max_width'] = $max_width; } else { $params = $this->parseFormat($max_width); + + if (array_key_exists('image_size', $params)) { + // image_size param shouldn't affect resized file name (crc part) + $image_size = $params['image_size']; + unset($params['image_size']); + } } if ($params['max_width'] > 0 || $params['max_height'] > 0) { @@ -67,6 +80,12 @@ } } + if ($image_size) { + // return only image size (resized or not) + $image_info = $this->getImageInfo($src_image); + return $image_info ? $image_info[3] : ''; + } + $base_url = rtrim($this->Application->BaseURL(), '/'); return preg_replace('/^'.preg_quote(FULL_PATH, '/').'(.*)/', $base_url.'\\1', $src_image); }