关注
Erlo

一个旋转图片的方法

2023-02-10 10:10:37 发布   240 浏览  
页面报错/反馈
收藏 点赞
function rotate($rotate=false){
    if(!$rotate)return true;
    $img=$this->tmp_name;
        $source=false;
        switch($this->fileType){
            case 'jpg':
                $source = imagecreatefromjpeg($img);
                $source = imagerotate($source, $rotate, 0);
                imagejpeg($source,$img);
                break;
            case 'png':
                $source = imagecreatefrompng($img);
                $source = imagerotate($source, $rotate, 0);
                imagepng($source,$img);
                break;
            case 'gif':
                $source = imagecreatefromgif($img);
                $source = imagerotate($source, $rotate, 0);
                imagegif($source,$img);
                break;
        }
        if($source)imagedestroy($source);
    return true;
}


登录查看全部

参与评论

评论留言

还没有评论留言,赶紧来抢楼吧~~

手机查看

返回顶部

给这篇文章打个标签吧~

棒极了 糟糕透顶 好文章 PHP JAVA JS 小程序 Python SEO MySql 确认