PHPackages                             dsentker/imageorientationfixer - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. dsentker/imageorientationfixer

ActiveLibrary[Image &amp; Media](/categories/media)

dsentker/imageorientationfixer
==============================

Fixes image orientation for uploaded images

231.6k2[1 PRs](https://github.com/dsentker/image-orientation-fixer/pulls)PHP

Since May 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/dsentker/image-orientation-fixer)[ Packagist](https://packagist.org/packages/dsentker/imageorientationfixer)[ RSS](/packages/dsentker-imageorientationfixer/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Image Orientation Fixer
=======================

[](#image-orientation-fixer)

Fixes image orientation problems for uploaded images.

The Problem
-----------

[](#the-problem)

An image that has a native dimension of 600x1500 pixels can still be displayed in landscape format (1500x600) if a corresponding value is stored in the metadata. This is the case, for example, when the image was taken with a smartphone, and the device was rotated 90 degrees for a horizontal format.

This image can lead to unexpected results in a browser (displayed with the well-known ![]()-element). The browser does not consider the EXIF information and displays the image incorrectly.

The Solution
------------

[](#the-solution)

Fortunately, smartphones and other modern devices stores suitable EXIF meta information in the images. This PHP library reads this information and automatically rotates the image as needed.

Advantages
----------

[](#advantages)

*ImageOrientationFixer* reads EXIF data from the image to evaluate the original orientation of the image. If the EXIF extension is not installed on the server, an alternative reader (RegexReader) can access this information with the help of regular expressions.

You have the choice of replacing the original image or saving it under a new name (I really do not know why you should do such a thing).

Disadvantages
-------------

[](#disadvantages)

This library uses the GD Image extension to access the filetype and for the rotation. As you know, this extension is memory-hungry. This library is therefore not suitable for the batch processing of multiple large images.

I welcome any help in this open-source project, for example to use a more flexible image processing library with DI.

Installation
------------

[](#installation)

Download the files from github and use the *autoloader.php* file located in /src/ImageOrientationFixer.

I recommend to use composer: ` composer require "dsentker/imageorientationfixer:*@dev"`

Usage
-----

[](#usage)

### Quick usage

[](#quick-usage)

```
use DSentker\ImageOrientationFixer\ImageOrientationFixer;
require_once 'vendor/autoload.php';

// image.jpg will be replaced with the fixed version of this image
ImageOrientationFixer::fixImage('path/to/image.jpg');
```

### Advantage Usage

[](#advantage-usage)

```
require_once 'vendor/autoload.php';

$imageFile = 'image.jpeg';

require '../src/ImageOrientationFixer/autoload.php';

$fixer = new \DSentker\ImageOrientationFixer\ImageOrientationFixer($imageFile);

/** @var \DSentker\ImageOrientationFixer\Image $fixedImage */
$fixedImage = $fixer->getFixedImage();
$fixedImage->save(); // Replace old image

// Alternate approach with the regex reader, if EXIF extension is not installed
$overwriteImage = true;
$regexFixer = new \DSentker\ImageOrientationFixer\ImageOrientationFixer($imageFile);
$regexFixer->setReader(new \DSentker\ImageOrientationFixer\OrientationReader\RegexReader());
$result = $regexFixer->getFixedImage()->saveAs('fixed.jpg', $overwriteImage);

if($result) {
    echo 'Are U A Wizard?';
}
```

Credits
-------

[](#credits)

- [Daniel Sentker](https://github.com/dsentker)

Submitting bugs and feature requests
------------------------------------

[](#submitting-bugs-and-feature-requests)

Bugs and feature request are tracked on GitHub.

ToDo (help is appreciated!)
---------------------------

[](#todo-help-is-appreciated)

- Write tests
- Create a factory for orientation reader
- Create Symfony3 bundle
- Let developer choose between GD/GD2, Imagick and other cool image libraries.

Copyright and license
---------------------

[](#copyright-and-license)

ImageOrientationFixer is licensed for use under the MIT License (MIT). Please see LICENSE for more information.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 Bus Factor1

Top contributor holds 90.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/9309c19594a948d4f0314bbdb2d3cfd56c84027fbd0fac6497c3e7098046be63?d=identicon)[dsentker](/maintainers/dsentker)

---

Top Contributors

[![dsentker](https://avatars.githubusercontent.com/u/86192?v=4)](https://github.com/dsentker "dsentker (10 commits)")[![mrbase](https://avatars.githubusercontent.com/u/304661?v=4)](https://github.com/mrbase "mrbase (1 commits)")

### Embed Badge

![Health badge](/badges/dsentker-imageorientationfixer/health.svg)

```
[![Health](https://phpackages.com/badges/dsentker-imageorientationfixer/health.svg)](https://phpackages.com/packages/dsentker-imageorientationfixer)
```

###  Alternatives

[milon/barcode

Barcode generator like Qr Code, PDF417, C39, C39+, C39E, C39E+, C93, S25, S25+, I25, I25+, C128, C128A, C128B, C128C, 2-Digits UPC-Based Extention, 5-Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI (Variation of Plessey code)

1.5k13.3M39](/packages/milon-barcode)[bkwld/croppa

Image thumbnail creation through specially formatted URLs for Laravel

510496.0k23](/packages/bkwld-croppa)[goat1000/svggraph

Generates SVG graphs

132849.6k3](/packages/goat1000-svggraph)[cohensive/embed

Media Embed (for Laravel or as a standalone).

120370.4k](/packages/cohensive-embed)[netresearch/rte-ckeditor-image

Image support in CKEditor for the TYPO3 ecosystem - by Netresearch

63991.3k4](/packages/netresearch-rte-ckeditor-image)[humanmade/tachyon-plugin

Rewrites WordPress image URLs to use Tachyon

87338.5k2](/packages/humanmade-tachyon-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
