Ed_imageresizer::Ed_imageresizer PHP Method

Ed_imageresizer() public method

Constructor
public Ed_imageresizer ( )
    public function Ed_imageresizer()
    {
        $this->EE =& get_instance();
        $this->EE->load->library('typography');
        $this->forceWidth = $this->EE->TMPL->fetch_param('forceWidth') != 'yes' ? FALSE : TRUE;
        $this->forceHeight = $this->EE->TMPL->fetch_param('forceHeight') != 'yes' ? FALSE : TRUE;
        $this->image = $this->EE->typography->parse_file_paths(preg_replace('/^(s?f|ht)tps?:\\/\\/[^\\/]+/i', '', (string) html_entity_decode(urldecode($this->EE->TMPL->fetch_param('image')))));
        $this->maxWidth = $this->EE->TMPL->fetch_param('maxWidth') != '' ? (int) $this->EE->TMPL->fetch_param('maxWidth') : 0;
        $this->maxHeight = $this->EE->TMPL->fetch_param('maxHeight') != '' ? (int) $this->EE->TMPL->fetch_param('maxHeight') : 0;
        $this->color = $this->EE->TMPL->fetch_param('color') != '' ? preg_replace('/[^0-9a-fA-F]/', '', (string) $this->EE->TMPL->fetch_param('color')) : FALSE;
        $this->cropratio = $this->EE->TMPL->fetch_param('cropratio');
        $this->class = $this->EE->TMPL->fetch_param('class');
        $this->title = $this->EE->TMPL->fetch_param('title');
        $this->id = $this->EE->TMPL->fetch_param('id');
        $this->alt = $this->EE->TMPL->fetch_param('alt');
        $this->default_image = (string) html_entity_decode($this->EE->TMPL->fetch_param('default'));
        $this->href_only = $this->EE->TMPL->fetch_param('href_only');
        $this->debug = $this->EE->TMPL->fetch_param('debug') != 'yes' ? false : true;
        $this->grayscale = $this->EE->TMPL->fetch_param('grayscale') != 'yes' ? false : true;
        /**
         * Load in cache path and server path from config if they exist
         *
         */
        if (!$this->server_path) {
            $this->server_path = rtrim($this->EE->config->item('ed_server_path'), '/');
        }
        if (!$this->cache_path) {
            $this->cache_path = rtrim($this->EE->config->item('ed_cache_path'), '/') . '/';
        }
        $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;
    }