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); } Index: branches/RC/core/kernel/utility/formatters/upload_formatter.php =================================================================== diff -u -N -r10714 -r11305 --- branches/RC/core/kernel/utility/formatters/upload_formatter.php (.../upload_formatter.php) (revision 10714) +++ branches/RC/core/kernel/utility/formatters/upload_formatter.php (.../upload_formatter.php) (revision 11305) @@ -171,6 +171,7 @@ 'file_paths' => 'full_path', 'file_sizes' => 'file_size', 'files_resized' => 'resize', + 'img_sizes' => 'img_size', 'wms' => 'wm', ); @@ -197,7 +198,7 @@ $format = isset($options['format']) ? $options['format'] : false; } - if ($format && preg_match('/(file_urls|file_paths|file_names|file_sizes|files_resized|wms)(.*)/', $format, $regs)) { + if ($format && preg_match('/(file_urls|file_paths|file_names|file_sizes|img_sizes|files_resized|wms)(.*)/', $format, $regs)) { if (!$value || $format == 'file_names') { // storage format matches display format OR no value return $value; @@ -268,6 +269,14 @@ case 'file_size': return filesize(FULL_PATH.$upload_dir.$value); break; + + case 'img_size': + $image_helper =& $this->Application->recallObject('ImageHelper'); + /* @var $image_helper ImageHelper */ + + $image_info = $image_helper->getImageInfo(FULL_PATH . $upload_dir . $value); + return $image_info ? $image_info[3] : ''; + break; } return sprintf($format, $value);