Search code examples
phpmobilecordovacameraappcelerator

Add "Take Photo With Camera" Feature On Website


I'm building a web application that requires the user to upload a photo. The application is built using HTML5, CSS, JavaScript (w/jQuery), and PHP for the backend. I would like to add, besides the file uploading option, another option for users who use the application on their mobile phone - to upload a picture using the phone's camera.

From browsing a bit, I understood there are 2 approaches to this matter:

  1. The Native Way - Building an independent application using Andorid's, iOS's and WM's SDK's and then having the user install them.
  2. The Cross-Platform Way - Using one of the available services, such as PhoneGap or Appcelerator Titanium to "compile" my web application into a variety of mobile phone applications, namely Android and iOS.

Thing is, I'm not interested in creating a separate application, and then having users install it on their phones.

I'm interested in letting a user, who chooses to use the web application on his mobile phone, the ability to take a photo using his mobile device.

How do I go about doing this?


Solution

  • You may take a look at the camera API which lets you either take an image from the device camera or use a stored image. Here's a description on it: https://developer.mozilla.org/en-US/docs/Web/Guide/API/Camera. It also features a demo there.