2017 © Pedro Peláez
 

library exif

A package for dealing with exif image orientation

image

rtablada/exif

A package for dealing with exif image orientation

  • Tuesday, July 1, 2014
  • by rtablada
  • Repository
  • 1 Watchers
  • 0 Stars
  • 182 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 2 Open issues
  • 1 Versions
  • 2 % Grown

The README.md

EXIF Based Auto Rotation

This is a simple class that allows you to auto-rotate your images based on EXIF data imbedded in JPG and TIFF images., (*1)

Installing

Add "rtablada/exif": "dev-master" to your composer.json file., (*2)

Use

Using this rotator takes a file path, SPLFileInfo instance, or Symfony\Request\UploadedFile along with an instance of Imagine (here we use GD). Then call rotate and you will be returned an auto-rotated image based on the EXIF data if any is present., (*3)

$imagine = new \Imagine\GD\Imagine;
$rotator = new \Rtablada\Exif\ExifRotator($pathToFile, $imagine);

$output = $resizer->rotate();
$output->save($outputPath);

Use with Stapler

This was originally built for use within a Laravel project using Stapler. Using this rotator with Stapler is quite simple when defining your styles:, (*4)

$this->hasAttachedFile('avatar', [
    'styles' => [
        'medium' => '300x300',
        'thumb' => function($file, $imagine) {
            $resizer = \Rtablada\Images\ResizeAndPad($file, $imagine);
            return $resizer->rotate();
        }
    ]
]);

Shorthand

If you would like to quickly rotate an image you can use makeAndRotate which skips the step of having to instantiate the rotator:, (*5)

\Rtablada\Images\ResizeAndPad::makeAndRotate($file, $imagine)->save($output);

The Versions

01/07 2014

dev-master

9999999-dev

A package for dealing with exif image orientation

  Sources   Download

MIT

The Requires