⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 transform.php

📁 完美的在线教育系统
💻 PHP
📖 第 1 页 / 共 2 页
字号:
            }            $this->img_x = $data[0];            $this->img_y = $data[1];            $this->type = $type;            return true;        } else {            echo("Cannot fetch image or images details.");            return null;        }        /*        $output = array(                        'width' => $data[0],                        'height' => $data[1],                        'type' => $type                        );        return $output;        */    }    /**     * Parse input and convert     * If either is 0 it will be scaled proportionally     *     * @access private     *     * @param mixed $new_size (0, number, percentage 10% or 0.1)     * @param int $old_size     *     * @return mixed none or PEAR_error     */    function _parse_size($new_size, $old_size)    {        if ('%' == $new_size) {            $new_size = str_replace('%','',$new_size);            $new_size = $new_size / 100;        }        if ($new_size > 1) {            return (int) $new_size;        } elseif ($new_size == 0) {            return (int) $old_size;        } else {            return (int) round($new_size * $old_size, 0);        }    }    function uniqueStr()    {      return substr(md5(microtime()),0,6);    }    //delete old tmp files, and allow only 1 file per remote host.    function cleanUp($id, $dir)    {        $d = dir($dir);        $id_length = strlen($id);        while (false !== ($entry = $d->read())) {            if (is_file($dir.'/'.$entry) && substr($entry,0,1) == '.' && !ereg($entry, $this->image))            {                //echo filemtime($this->directory.'/'.$entry)."<br>";                 //echo time();                if (filemtime($dir.'/'.$entry) + $this->lapse_time < time())                    unlink($dir.'/'.$entry);                if (substr($entry, 1, $id_length) == $id)                {                    if (is_file($dir.'/'.$entry))                        unlink($dir.'/'.$entry);                }            }        }        $d->close();    }    function createUnique($dir)    {       $unique_str = '.'.$this->uid.'_'.$this->uniqueStr().".".$this->type;               //make sure the the unique temp file does not exists        while (file_exists($dir.$unique_str))        {            $unique_str = '.'.$this->uid.'_'.$this->uniqueStr().".".$this->type;        }              $this->cleanUp($this->uid, $dir);       return $unique_str;    }    /**     * Set the image width     * @param int $size dimension to set     * @since 29/05/02 13:36:31     * @return     */    function _set_img_x($size)    {        $this->img_x = $size;    }    /**     * Set the image height     * @param int $size dimension to set     * @since 29/05/02 13:36:31     * @return     */    function _set_img_y($size)    {        $this->img_y = $size;    }    /**     * Set the image width     * @param int $size dimension to set     * @since 29/05/02 13:36:31     * @return     */    function _set_new_x($size)    {        $this->new_x = $size;    }    /**     * Set the image height     * @param int $size dimension to set     * @since 29/05/02 13:36:31     * @return     */    function _set_new_y($size)    {        $this->new_y = $size;    }    /**     * Get the type of the image being manipulated     *     * @return string $this->type the image type     */    function getImageType()    {        return $this->type;    }    /**     *     * @access public     * @return string web-safe image type     */    function getWebSafeFormat()    {        switch($this->type){            case 'gif':            case 'png':                return 'png';                break;            default:                return 'jpeg';        } // switch    }    /**     * Place holder for the real resize method     * used by extended methods to do the resizing     *     * @access private     * @return PEAR_error     */    function _resize() {        return null; //PEAR::raiseError("No Resize method exists", true);    }    /**     * Place holder for the real load method     * used by extended methods to do the resizing     *     * @access public     * @return PEAR_error     */    function load($filename) {        return null; //PEAR::raiseError("No Load method exists", true);    }    /**     * Place holder for the real display method     * used by extended methods to do the resizing     *     * @access public     * @param string filename     * @return PEAR_error     */    function display($type, $quality) {        return null; //PEAR::raiseError("No Display method exists", true);    }    /**     * Place holder for the real save method     * used by extended methods to do the resizing     *     * @access public     * @param string filename     * @return PEAR_error     */    function save($filename, $type, $quality) {        return null; //PEAR::raiseError("No Save method exists", true);    }    /**     * Place holder for the real free method     * used by extended methods to do the resizing     *     * @access public     * @return PEAR_error     */    function free() {        return null; //PEAR::raiseError("No Free method exists", true);    }    /**     * Reverse of rgb2colorname.     *     * @access public     * @return PEAR_error     *     * @see rgb2colorname     */    function colorhex2colorarray($colorhex) {        $r = hexdec(substr($colorhex, 1, 2));        $g = hexdec(substr($colorhex, 3, 2));        $b = hexdec(substr($colorhex, 4, 2));        return array($r,$g,$b);    }    /**     * Reverse of rgb2colorname.     *     * @access public     * @return PEAR_error     *     * @see rgb2colorname     */    function colorarray2colorhex($color) {        $color = '#'.dechex($color[0]).dechex($color[1]).dechex($color[2]);        return strlen($color)>6?false:$color;    }    /* Methods to add to the driver classes in the future */    function addText()    {        return null; //PEAR::raiseError("No addText method exists", true);    }    function addDropShadow()    {        return null; //PEAR::raiseError("No AddDropShadow method exists", true);    }    function addBorder()    {        return null; //PEAR::raiseError("No addBorder method exists", true);    }    function crop()    {        return null; //PEAR::raiseError("No crop method exists", true);    }    function flip()     {        return null;    }    function gamma()    {        return null; //PEAR::raiseError("No gamma method exists", true);    }}?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -