PHP Classes
elePHPant
Icontem

PHP Auto Rotate Image Exif: Rotate images automatically based on orientation

Recommend this page to a friend!
  Info   View files Documentation   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2017-03-20 (8 days ago) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
images-auto-rotate 1.0Freeware5PHP 5, Graphics
Description Author

This class can rotate images automatically based on orientation.

It can read the image EXIT metadata and rotate or mirror the image according to the current orientation.

The rotated image is saved back to file in the same format.

  Performance   Level  
Name: José Quijado <contact>
Classes: 2 packages by
Country: Spain Spain

Details

AUTO ROTATE IMAGES

If you have a web site where users can upload photos, you have a trouble. Photos taken with a smart phone or digital camera can include some EXIF data, which make an image to be rotated 90??, 180?? or 270??, so the image will appear rotated in the web page, even if it looked to be fine when uploaded.

You can use class.ExifCleaning.php to clean exif metadata, so the image will appear properly.

First, you must include this class in the script which gets the user image and stores it on the server disk: include ("path_to_the_class_file/class.ExifCleaning.php");

The you must be sure the path to the image file, and the image file itself are Apache writeable. I gues they are, or you couldn't save the image with move_uploaded_file().

Now (once the image is saved onto the disk) write a sentence like this one:

ExifCleaning::adjustImageOrientation("path_to_the_image_file/image_file.jpg"); // Most of the smartphones / digital cameras images are jpg type.

Thats all. Now EXIF rotating metadata are removed, and the image will be properly rendered in your site.

This version supports jpg, gif, png or bmp images.

You can read more (in spanish) on https://eldesvandejose.com/2017/02/21/rotacion-automatica-de-imagenes/

  Files folder image Files  
File Role Description
Plain text file class.ExifCleaning.php Class Class source
Accessible without login Plain text file README.md Doc. Documentation

 Version Control Unique User Downloads  
 100%
Total:0
This week:0