Web App Image Rotate Issue
Problem:
When uploading image taken from iPhone, it is displayed on the website rotated 90 degrees counter-clockwise. I've done research and understand certain meta data contained in the image file is causing this. Is there a good library to determine if this meta data is in the file and rotate it properly?
My app is build with Laravel and I was looking at Intervention Image to see if maybe that can solve this.
Thanks!
UPDATE:
Still not working. I've checked the php modules and exif and mbstring are enabled on the server.
Here's my code in my laravel controller. The image saves to the directory I specify, but just doesn't orientate properly. Image taken on mobile still shows as rotated on desktop. Thanks!
if (Input::hasFile('profile-image'))
{
$extension = Input::file('profile-image')->getClientOriginalExtension();
$fileName = rand(11111,99999).'.'.$extension;
$image = Image::make(Input::file('profile-image'))->orientate()->save('images/profiles/'.$fileName);
Auth::user()->update([
'image_path' => $fileName,
]);
}
Answer
Yes, you'll want the orientate()
function it provides.
http://image.intervention.io/api/orientate
Modern cameras add EXIF data to photos that includes the orientation (as well as details about flash, exposure, aperture, etc.). Intervention and other libraries (I've used jhead in the past for autorotation) can use this data.
Related Questions
- → Function Undefined in Axios promise
- → What are the pluses/minuses of different ways to configure GPIOs on the Beaglebone Black?
- → Click to navigate on mobile devices
- → Playing Video - Server is not correctly configured - 12939
- → How to allow api access to android or ios app only(laravel)?
- → Axios array map callback
- → Access the Camera and CameraRoll on Android using React Native?
- → Update React [Native] View on Day Change
- → Shopify iOS SDK - issue converting BuyProductVariant to BuyProduct
- → BigCommerce and shopify API
- → Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `ListView`
- → React Native - Differences between Android and IOS
- → What is the difference between React Native and React?