From b73ca29b58768acc1b32e05dfb6f9c35a7b453ab Mon Sep 17 00:00:00 2001 From: vAugagneur Date: Tue, 5 Feb 2013 14:16:47 +0100 Subject: [PATCH] //added getWidthSize and getHeightSize method in tpl thanks to @PrestaEdit --- classes/Image.php | 12 ++++++++++++ config/smarty.config.inc.php | 3 +++ 2 files changed, 15 insertions(+) diff --git a/classes/Image.php b/classes/Image.php index 41e24bbe8..f2b749bf1 100644 --- a/classes/Image.php +++ b/classes/Image.php @@ -367,6 +367,18 @@ class ImageCore extends ObjectModel '); return self::$_cacheGetSize[$type]; } + + public static function getWidth($params, &$smarty) + { + $result = self::getSize($params['type']); + return $result['width']; + } + + public static function getHeight($params, &$smarty) + { + $result = self::getSize($params['type']); + return $result['height']; + } /** * Clear all images in tmp dir diff --git a/config/smarty.config.inc.php b/config/smarty.config.inc.php index 2ddefc55a..892a22dd3 100644 --- a/config/smarty.config.inc.php +++ b/config/smarty.config.inc.php @@ -80,6 +80,9 @@ smartyRegisterFunction($smarty, 'function', 'displayPrice', array('Tools', 'disp smartyRegisterFunction($smarty, 'modifier', 'convertAndFormatPrice', array('Product', 'convertAndFormatPrice')); // used twice smartyRegisterFunction($smarty, 'function', 'getAdminToken', array('Tools', 'getAdminTokenLiteSmarty')); smartyRegisterFunction($smarty, 'function', 'displayAddressDetail', array('AddressFormat', 'generateAddressSmarty')); +smartyRegisterFunction($smarty, 'function', 'getWidthSize', array('Image', 'getWidth')); +smartyRegisterFunction($smarty, 'function', 'getHeightSize', array('Image', 'getHeight')); + function smartyDieObject($params, &$smarty) {