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);    
     }

  • 相关阅读:
    Latex: 插入数学公式
    Matlab: 作图
    Random Access Iterator 2019 ICPC 徐州网络赛(树上概率DP)
    2019南京网络赛D Robots(概率DP+拓扑序)
    HDU3507 Print Article(斜率优化+单调队列)
    hdu4632(区间dp)
    POJ 1651 Multiplication Puzzle 区间DP
    暑假集训
    POJ-2955(区间DP)
    kuangbin计算几何模板转载
  • 原文地址:https://www.cnblogs.com/lijiageng/p/5741486.html
Copyright © 2011-2022 走看看