Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Ionic Cookbook

You're reading from   Ionic Cookbook Over 35 exciting recipes to spice up your application development with Ionic

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher Packt
ISBN-13 9781785287978
Length 264 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Hoc Phan Hoc Phan
Author Profile Icon Hoc Phan
Hoc Phan
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Creating Our First App with Ionic FREE CHAPTER 2. Managing States and Navigation 3. Adding Device Features Support 4. Offline Data Storage 5. Handling Gestures and Events 6. App Theme Customization 7. Extending Ionic with Your Own Components 8. User Registration and Authentication 9. Saving and Loading Data Using Firebase 10. Finalizing Your Apps for Different Platforms Index

Taking a photo using the device camera

For this recipe, 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 Base64 format or saved in a local filesystem of your app. Here is the high-level process:

  • Access the Cordova Camera plugin to trigger camera capture and get the image back in the Base64 or file URI format
  • Parse the Base64 data or URI on a <img> DOM object
  • Display 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

You should have a physical device ready in order to test camera capability. It's possible to just run it via an emulator, but the filesystem support might look different across platforms.

This section also requires Bower to be installed. Bower is a utility to help you manage packages for the frontend. It makes installing packages easier because you don't have to hunt all over...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime