PHP code example of ministryofweb / image-fix-exif-orientation
1. Go to this page and download the library: Download ministryofweb/image-fix-exif-orientation library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
ministryofweb / image-fix-exif-orientation example snippets
php
declare(strict_types=1);
use MinistryOfWeb\ImageFixExifOrientation\Fixer\Gd;
use MinistryOfWeb\ImageFixExifOrientation\Fixer\ImageMagick;
use MinistryOfWeb\ImageFixExifOrientation\Image;
use MinistryOfWeb\ImageFixExifOrientation\OrientationFixer;
use MinistryOfWeb\ImageFixExifOrientation\Output\Filesystem;
use MinistryOfWeb\ImageFixExifOrientation\Output\ImageString;
// please initialize Composer vendor directory first (by running `composer install`)
rite to a temporary file
// in the file system; getting the image data as a string is also possible
$output = new Filesystem(tempnam(sys_get_temp_dir(), 'ministryofweb-exif-fix') . '.jpg');
//$output = new ImageString();
// (4) initialize the fixer
$fixer = new OrientationFixer($fixer, $output);
// (5) fix the image
$fixer->fix($image);
echo 'Fixed image: ' . $output->getFile() . PHP_EOL;