Beispiel #1
0
        $src_y = $this->getImgHeight($src);
        $new_im = imagecreatetruecolor($src_x, $src_y);
        for ($y = 0; $y < $src_y; $y++) {
            imagecopy($new_im, $src, 0, $src_y - $y - 1, 0, $y, $src_x, 1);
        }
        $this->h_src = $new_im;
    }
    /**
     * 水平翻转
     *
     * @param    string     $src    图片源
     */
    function _flipH($src)
    {
        $src_x = $this->getImgWidth($src);
        $src_y = $this->getImgHeight($src);
        $new_im = imagecreatetruecolor($src_x, $src_y);
        for ($x = 0; $x < $src_x; $x++) {
            imagecopy($new_im, $src, $src_x - $x - 1, 0, $x, 0, 1, $src_y);
        }
        $this->h_src = $new_im;
    }
}
$t = new ThumbHandler();
// 基本使用
$t->setSrcImg("./bg_login.jpg");
$t->setMaskWord("test");
$t->setDstImgBorder(10, "#dddddd");
$t->setDstImg("./new_test.jpg");
// 指定缩放比例
$t->createImg(170, 170);