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

  • 相关阅读:
    Docker化高可用redis集群
    机器学习理论研究方法探讨
    (转载)iOS系统Crash文件分析方法
    ios 学习总结之动画(转)
    (转)iOS sqlite :truncate/delete/drop区分
    (转载)自定义 setDateFormat 显示格式
    (转载)IOS中UIScrollView的属性和委托方法
    vue 实现分页加载数据
    深入理解JQuery插件开发
    博客迁移到GitCafe
  • 原文地址:https://www.cnblogs.com/lijiageng/p/5741486.html
Copyright © 2011-2022 走看看