9951 explained code solutions for 126 technologies


php-gdGet image orientation


We can use EXIF data to get image orientation (in case it has this data set):

<?php

$orientation = exif_read_data('photo.jpg')['COMPUTED']['Orientation'];ctrl + c
exif_read_data

returns EXIF data of a specified image

['COMPUTED']['Orientation']

get orientation value from EXIF data

$orientation

will contain orientation value