exifPHP扩展名或使用
PEL。
基本上,您必须读取
Orientation文件中的标志。这是一个使用
exifPHP扩展并
WideImage用于图像处理的示例。
<?php$exif = exif_read_data($filename);$ort = $exif['Orientation'];$image = WideImage::load($filename);// GD doesn't support EXIF, so all information is removed.$image->exifOrient($ort)->saveToFile($filename);class WideImage_Operation_ExifOrient{ function execute($img, $orientation) { switch ($orientation) { case 2: return $img->mirror(); break; case 3: return $img->rotate(180); break; case 4: return $img->rotate(180)->mirror(); break; case 5: return $img->rotate(90)->mirror(); break; case 6: return $img->rotate(90); break; case 7: return $img->rotate(-90)->mirror(); break; case 8: return $img->rotate(-90); break; default: return $img->copy(); } }}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)