/** * Constructor * * @param unknown_type $isnot_ee */ public function Ed_imageresizer() { global $TMPL, $IN, $PREFS; $TYPE = new Typography(); $this->forceWidth = $TMPL->fetch_param('forceWidth') != 'yes' ? FALSE : TRUE; $this->forceHeight = $TMPL->fetch_param('forceHeight') != 'yes' ? FALSE : TRUE; $this->image = $TYPE->parse_file_paths(preg_replace('/^(s?f|ht)tps?:\\/\\/[^\\/]+/i', '', (string) html_entity_decode($TMPL->fetch_param('image')))); $this->maxWidth = $TMPL->fetch_param('maxWidth') != '' ? (int) $TMPL->fetch_param('maxWidth') : 0; $this->maxHeight = $TMPL->fetch_param('maxHeight') != '' ? (int) $TMPL->fetch_param('maxHeight') : 0; $this->color = $TMPL->fetch_param('color') != '' ? preg_replace('/[^0-9a-fA-F]/', '', (string) $TMPL->fetch_param('color')) : FALSE; $this->cropratio = $TMPL->fetch_param('cropratio'); $this->class = $TMPL->fetch_param('class'); $this->title = $TMPL->fetch_param('title'); $this->id = $TMPL->fetch_param('id'); $this->alt = $TMPL->fetch_param('alt'); $this->default_image = (string) html_entity_decode($TMPL->fetch_param('default')); $this->href_only = $TMPL->fetch_param('href_only'); $this->debug = $TMPL->fetch_param('debug') != 'yes' ? false : true; $this->grayscale = $TMPL->fetch_param('grayscale') != 'yes' ? false : true; // LOW EDIT: Get server and cache paths from config file if (!$this->server_path) { $this->server_path = $PREFS->ini('ed_server_path'); } if (!$this->cache_path) { $this->cache_path = $PREFS->ini('ed_cache_path'); } // END LOW EDIT $error_string = '<div style="background:#f00; color:#fff; font:bold 11px verdana; padding:12px; border:2px solid #000">%s</div>'; if ($this->cache_path == '' || $this->server_path == '') { if ($this->debug) { $this->return_data = sprintf($error_string, 'The cache and server paths need to be set in your config file.'); } else { $this->return_data = ''; } return; } $ret = $this->_run(); // error if (is_array($ret) && $this->debug) { $this->return_data = sprintf($error_string, $ret[2]); return; } elseif (is_array($ret)) { return; } $this->return_data = $ret; return; }