function magiczoomplus_getThumb($src, $size = null, $pid = null) { if ($size === null) { $size = 'thumb'; } require_once MTOOLBOX_ADMIN_FOLDER_magiczoomplus . 'magictoolbox.imagehelper.class.php'; if (defined('HTTP_IMAGE')) { $url = str_replace('image/', '', HTTP_IMAGE); } else { $url = HTTP_SERVER; } $shop_dir = str_replace('system/', '', DIR_SYSTEM); $image_dir = str_replace($shop_dir, '', DIR_IMAGE); $imagehelper = new MagicToolboxImageHelperClass($shop_dir, '/' . $image_dir . 'magictoolbox_cache', $GLOBALS["magictoolbox"]["magiczoomplus"]->params, null, $url); return $imagehelper->create('/' . $src, $size, $pid); }
function fn_magiczoom_create_thumb($src, $size, $pid) { static $imagehelper = null; static $prefix = ''; if ($imagehelper === null) { $prefix = Registry::get('config.current_location'); $options = Settings::instance()->getValue('cdn', ''); if (!empty($options)) { $options = unserialize($options); if ((bool) $options['is_enabled']) { /* $cdn = Cdn::instance()->getHost('host'); if(!empty($cdn)) { $prefix = (defined('HTTPS') ? 'https:' : 'http:').'//'.$cdn; } */ if (!empty($options['cname'])) { $prefix = (defined('HTTPS') ? 'https:' : 'http:') . '//' . $options['cname']; } else { if (!empty($options['host'])) { $prefix = (defined('HTTPS') ? 'https:' : 'http:') . '//' . $options['host']; } } } } $tool = fn_magiczoom_load(); require_once dirname(__FILE__) . '/classes/magictoolbox.imagehelper.class.php'; $imagehelper = new MagicToolboxImageHelperClass(Registry::get('config.dir.root'), '/images/magictoolbox_cache', $tool->params, null, Registry::get('config.http_path')); } $src = str_replace($prefix, '', $src); //NOTE: with / $src = preg_replace('#\\?.*+$#', '', $src); //NOTE: if it has some GET options, cut it $src = htmlspecialchars_decode($src, ENT_QUOTES); $thumb = $imagehelper->create($src, $size, $pid); //NOTE: spike to get real size of image //$GLOBALS['magictoolbox']['file_path'] = $imagehelper->file; if (MT_DS != '/') { $thumb = str_replace(MT_DS, '/', $thumb); } return $thumb; }
function getThumb($src, $size = null, $pid = null) { if ($size === null) { $size = 'thumb'; } require_once dirname(__FILE__) . '/magictoolbox.imagehelper.class.php'; $url = str_replace('image/', '', HTTP_IMAGE); $shop_dir = str_replace('system/', '', DIR_SYSTEM); $image_dir = str_replace($shop_dir, '', DIR_IMAGE); $imagehelper = new MagicToolboxImageHelperClass($shop_dir, '/' . $image_dir . 'magictoolbox_cache', $GLOBALS["magictoolbox"]["magiczoom"]->params, null, $url); return $imagehelper->create('/' . $src, $size, $pid); }