Benefits of EXIF

Hello guys! I hope you are doing well in these difficult times. Here I’m welcoming you to my very first blog. This blog is about image rotation issues. Most of the times, we start designing the website and issues related to image pops up one by one. At the initial stage, we create a website design by using nice images with matching background where everything is just perfect and when website goes live, the unwanted devil turns up. Because we develop using the designs provided by the designer, we often tend to forget about how the final output will be when the actual data is loaded.

See the below example, here at initial time we show the profile picture in round box and user’s face will show perfectly as we want but sometimes user clicks profile in landscape mode or upload upside down image and it’s look very messy in live website. Now here I’ll try to solve this issue. So, let’s begin...

We will use EXIF functions to get image details. It’ll help us to solve our issue and make our site more accessible.

But wait, what is EXIF? EXIF stands for Exchangeable Image Information and it helps us to read meta data about the images. Now for beginners meta data is “data about data” like more information about our image. EXIF functions will help to read details of image like from which digital camera the image was captured, what was aperture of the image, flash, exposure and many such.

exif-content1

EXIF data can only read the meta details of JPEG and TIFF images (which is mostly used in digital cameras). So, make sure you use image with the right format while experimenting with the code.

EXIF functions:

1. exif_imagetype

This function accepts the file path and returnsinteger value of that image. For example,if we upload JPEG image,it’ll return 2 (IMAGETYPE_JPEG).

Click here to See all image type options from here.

2. exif_read_data

This function is very useful to read meta data of image. It’ll give all possible values of image like type, model number of camera, ApertureFNumber, flash, exposure, ISO, etc. We show all the information in PHP example.

3.exif_thumbnail

This function is used to generate thumbnail fromtheimage. Here it’ll return the height, width and image type.

Get the Code


Leave a Reply

Your email address will not be published. Required fields are marked *