zoukankan      html  css  js  c++  java
  • 处理图片出现翻转的问题

    首先保证   php   开   exif  扩展

     function rote($file){
        $imagemodel = new Image();
             $info = $imagemodel::GetImageInfo($file);
             $type = empty($type) ? $info['type'] : $type;
             $type = strtolower($type);
             unset($info);
             $image = imagecreatefromstring(file_get_contents($file));
             //file_put_contents($log, $image.' ');
            $exif = @exif_read_data($file);
           if(isset($exif['Orientation']) && !empty($exif['Orientation'])) {
                                   switch($exif['Orientation']) {
                                                  case 8:
                                                  $image = imagerotate($image,90,0);
                                                  break;
                                                  case 3:
                                                  $image = imagerotate($image,180,0);
                                                  break;
                                                  case 6:
                                                 $image = imagerotate($image,-90,0);
                                                 break;
                                  }
             }
        $imageFun = 'image' . ($type == 'jpg' ? 'jpeg' : $type);
        $imageFun($image,$file);
        imagedestroy($image);    
     }

  • 相关阅读:
    博客作业,每周例行报告 第二次作业
    接口基本知识
    python学习-unittest笔记
    读取monkey日志,并存放到另一个文件中
    python学习1-django创建项目及应用
    简单正则表达式python
    adb devices 显示端口被占用时如何处理
    将txt文件 导入到excel中
    将 列表转换成 字典格式
    将文件中的内容读出来且 用逗号隔开换行显示
  • 原文地址:https://www.cnblogs.com/lijiageng/p/5741486.html
Copyright © 2011-2022 走看看