首页 > Web开发 > 详细

PHP按坐标裁图

时间:2018-07-16 18:23:55      阅读:236      评论:0      收藏:0      [点我收藏+]
 /**
     * 按坐标裁图
     * 参数:起始坐标,裁剪长宽,图片
     * 坐标($h,$w)
     * 长宽($height,$weight)
     */
    public function actionCutByPoint()
    {
        // $data = $_POST;
        $data = $_GET;

        $filename = dirname(dirname(dirname(dirname(__FILE__)))).‘\web\upload_pic\test114.png‘;
        $source = imagecreatefrompng($filename);

        list($PNGWidth, $PNGHeight) = getimagesize($filename);
        $thumb = ImageCreateTrueColor( $data[‘weight‘],$data[‘height‘]);
        imagecopyresized( $thumb, $source, 0, 0, $data[‘w‘], $data[‘h‘], $data[‘weight‘], $data[‘height‘],  $data[‘weight‘], $data[‘height‘]);
        imagejpeg( $thumb , "./upload_pic/Cut/{$data[‘w‘]}-{$data[‘h‘]}.jpg" ,100);

    }

 

PHP按坐标裁图

原文:https://www.cnblogs.com/liuliwei/p/9319066.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!