O'Reilly logo

Ionic : Hybrid Mobile App Development by Hoc Phan, Sani Yusuf, Rahat Khanna

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Taking a photo using the camera plugin

For this section, you will make an app to take a picture using the device camera or load an existing picture from the device album. The picture could be either in the Base64 format or saved in a local filesystem relating to your app. The following is a screenshot of the app:

Taking a photo using the camera plugin

Here is the high-level process:

  • Access the Cordova camera plugin to trigger camera capture and get the image back in the Base64 or URI format
  • Parse the Base64 data or URI on an <img> DOM object
  • Display the URI if it's in the URI format
  • Capture an event of a toggle component
  • Display long data (for example, URI) using horizontal scroll

Getting ready ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required