O'Reilly logo

PhoneGap By Example by Andrey Kovalenko

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

Saving the dressed photo into the application's folder

To save the picture in the application's folder ,we need to implement the store and model of the picture and some logic.

Defining the picture model and store

The picture model itself is very simple. Let's create it and put it under app/model/Picture.js:

Ext.define('Imaginary.model.Picture', {
    extend: 'Ext.data.Model',
    config: {
        fields: [
            { name: 'id', type: 'int' },
            { name: 'url', type: 'string' }
        ]
    }
});

Where:

  • id is the generated identifier in locaStorage
  • url is the path to the picture on the device

The store is a little different than the one for effects. Let's add the following lines of code in the app/store/Pictures.js file:

The Pictures.js store, is as follows:

Ext.define('Imaginary.store.Pictures',{ ...

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