Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Check if image is uploaded from camera or gallery in mobile browser

I am having this code:

<input id="video-selector" type="file" name="files[]" accept="video/*,image/*" capture="camera" >

I need to check whether the image is taken from camera or from gallery. Is there any way to do so. Or Is there any option to restrict upload from gallery.

like image 336
Chetan Mehta Avatar asked Oct 29 '22 02:10

Chetan Mehta


1 Answers

I assume what you want to do is to make sure the user is taking a "fresh" photo.

I don't think there's a way to restrict choosing images from the gallery. But an alternative solution would be: make sure the photo was taken in the most recent few seconds (e.g. 60 seconds).

There is an "original date" property in EXIF info which won't be very easily changeable on phones. You can access EXIF tags easily by JavaScript with the help of exif-js.

like image 140
Michael Yin Avatar answered Nov 13 '22 03:11

Michael Yin