src/ext-3rd/tinymce/plugins/images/connector/php/Image_Toolbox.class.php
function _loadFile($filename)
    {
        if (file_exists($filename))
        {
            $info = getimagesize($filename);
            $filedata['width'] = $info[0];
            $filedata['height'] = $info[1];
            ($filedata['width'] >= $filedata['height']) ? ($filedata['bias'] = IMAGE_TOOLBOX_BIAS_HORIZONTAL) : ($filedata['bias'] = IMAGE_TOOLBOX_BIAS_VERTICAL);
            $filedata['aspectratio'] = $filedata['width'] / $filedata['height'];
            $filedata['type'] = $info[2];

            if ($this->_types[$filedata['type']]['supported'] < 1)
            {
                //trigger_error($this->_error_prefix . 'Imagetype ('.$this->_types[$filedata['type']]['ext'].') not supported for reading.', E_USER_ERROR);
                return null;
            }
            switch ($filedata['type'])
            {
                case 1:
                    $dummy = imagecreatefromgif($filename);
                    $functionname = $this->_imagecreatefunction;
                    $filedata['resource'] = $functionname($filedata['width'], $filedata['height']);
                    imagecopy($filedata['resource'], $dummy, 0, 0, 0, 0, $filedata['width'], $filedata['height']);
                    imagedestroy($dummy);
                    break;

                case 2:
                    $filedata['resource'] = imagecreatefromjpeg($filename);
                    break;

                case 3:
                    $dummy = imagecreatefrompng($filename);
                    if (imagecolorstotal($dummy) != 0)
                    {
                        $functionname = $this->_imagecreatefunction;
                        $filedata['resource'] = $functionname($filedata['width'], $filedata['height']);
                        imagecopy($filedata['resource'], $dummy, 0, 0, 0, 0, $filedata['width'], $filedata['height']);
                    }
                    else
                    {
                        $filedata['resource'] = $dummy;
                    }
                    unset($dummy);
                    break;

                default:
                    //trigger_error($this->_error_prefix . 'Imagetype not supported.', E_USER_ERROR);
                    return null;
            }
            return $filedata;
        }
        else
        {
            //trigger_error($this->_error_prefix . 'Imagefile (' . $filename . ') does not exist.', E_USER_ERROR);
            return null;
        }
    }
function _loadFile($filename)
    {
        if (file_exists($filename))
        {
            $info = getimagesize($filename);
            $filedata['width'] = $info[0];
            $filedata['height'] = $info[1];
            ($filedata['width'] >= $filedata['height']) ? ($filedata['bias'] = IMAGE_TOOLBOX_BIAS_HORIZONTAL) : ($filedata['bias'] = IMAGE_TOOLBOX_BIAS_VERTICAL);
            $filedata['aspectratio'] = $filedata['width'] / $filedata['height'];
            $filedata['type'] = $info[2];

            if ($this->_types[$filedata['type']]['supported'] < 1)
            {
                //trigger_error($this->_error_prefix . 'Imagetype ('.$this->_types[$filedata['type']]['ext'].') not supported for reading.', E_USER_ERROR);
                return null;
            }
            switch ($filedata['type'])
            {
                case 1:
                    $dummy = imagecreatefromgif($filename);
                    $functionname = $this->_imagecreatefunction;
                    $filedata['resource'] = $functionname($filedata['width'], $filedata['height']);
                    imagecopy($filedata['resource'], $dummy, 0, 0, 0, 0, $filedata['width'], $filedata['height']);
                    imagedestroy($dummy);
                    break;

                case 2:
                    $filedata['resource'] = imagecreatefromjpeg($filename);
                    break;

                case 3:
                    $dummy = imagecreatefrompng($filename);
                    if (imagecolorstotal($dummy) != 0)
                    {
                        $functionname = $this->_imagecreatefunction;
                        $filedata['resource'] = $functionname($filedata['width'], $filedata['height']);
                        imagecopy($filedata['resource'], $dummy, 0, 0, 0, 0, $filedata['width'], $filedata['height']);
                    }
                    else
                    {
                        $filedata['resource'] = $dummy;
                    }
                    unset($dummy);
                    break;

                default:
                    //trigger_error($this->_error_prefix . 'Imagetype not supported.', E_USER_ERROR);
                    return null;
            }
            return $filedata;
        }
        else
        {
            //trigger_error($this->_error_prefix . 'Imagefile (' . $filename . ') does not exist.', E_USER_ERROR);
            return null;
        }
    }
function _loadFile ( $ filename ) { if ( file_exists ( $ filename ) ) { $ info = getimagesize ( $ filename ) ; $ filedata [ 'width' ] = $ info [ 0 ] ; $ filedata [ 'height' ] = $ info [ 1 ] ; ( $ filedata [ 'width' ] >= $ filedata [ 'height' ] ) ? ( $ filedata [ 'bias' ] = IMAGE_TOOLBOX_BIAS_HORIZONTAL ) : ( $ filedata [ 'bias' ] = IMAGE_TOOLBOX_BIAS_VERTICAL ) ; $ filedata [ 'aspectratio' ] = $ filedata [ 'width' ] / $ filedata [ 'height' ] ; $ filedata [ 'type' ] = $ info [ 2 ] ; if ( $ this -> _types [ $ filedata [ 'type' ] ] [ 'supported' ] < 1 ) { //trigger_error($this->_error_prefix . 'Imagetype ('.$this->_types[$filedata['type']]['ext'].') not supported for reading.', E_USER_ERROR); return null ; } switch ( $ filedata [ 'type' ] ) { case 1 : $ dummy = imagecreatefromgif ( $ filename ) ; $ functionname = $ this -> _imagecreatefunction ; $ filedata [ 'resource' ] = $ functionname ( $ filedata [ 'width' ] , $ filedata [ 'height' ] ) ; imagecopy ( $ filedata [ 'resource' ] , $ dummy , 0 , 0 , 0 , 0 , $ filedata [ 'width' ] , $ filedata [ 'height' ] ) ; imagedestroy ( $ dummy ) ; break ; case 2 : $ filedata [ 'resource' ] = imagecreatefromjpeg ( $ filename ) ; break ; case 3 : $ dummy = imagecreatefrompng ( $ filename ) ; if ( imagecolorstotal ( $ dummy ) != 0 ) { $ functionname = $ this -> _imagecreatefunction ; $ filedata [ 'resource' ] = $ functionname ( $ filedata [ 'width' ] , $ filedata [ 'height' ] ) ; imagecopy ( $ filedata [ 'resource' ] , $ dummy , 0 , 0 , 0 , 0 , $ filedata [ 'width' ] , $ filedata [ 'height' ] ) ; } else { $ filedata [ 'resource' ] = $ dummy ; } unset ( $ dummy ) ; break ; default : //trigger_error($this->_error_prefix . 'Imagetype not supported.', E_USER_ERROR); return null ; } return $ filedata ; } else { //trigger_error($this->_error_prefix . 'Imagefile (' . $filename . ') does not exist.', E_USER_ERROR); return null ; } }
Loads a image file

@access private
@param string $filename imagefile to load
@return array associative array with the loaded filedata
Loads a image file