Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Thread: How to take a photo using Camera in Sencha App?

  1. #1
    Sencha User arindam.hit's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    99
    Answers
    1

    Default Answered: How to take a photo using Camera in Sencha App?

    I am trying to take a picture using camera in Sencha Touch 2. Here i have one button 'Take a Picture', when i will press it, camera should start. As i am new to this sencha touch 2, i am unable to figure it out, how to do this? For this i used the below code:

    http://www.senchafiddle.com/#qlH6u

    I have gone through this link:
    http://docs.sencha.com/touch/2-0/#!/....device.Camera
    Please help me. I do not want to use Phone gap.


    Thanks.

  2. Maybe the following example will help:

    https://github.com/CaliLuke/NativeCo...iew/Picture.js

  3. #2
    Sencha User
    Join Date
    Mar 2010
    Posts
    71
    Answers
    1

    Default

    if you checked that link you saw that you can use the sencha native packager also not only phonegap. Does that help?

    If you were looking at getting an image capture on a desktop machine using a webcam you are forced afaik to use a flash component.Maybe this link will help:

    http://stackoverflow.com/questions/3782169/capture-image-from-camera-into-form-or-html5-canvas


  4. #3
    Sencha User
    Join Date
    Oct 2011
    Location
    Germany
    Posts
    146
    Answers
    4

    Default

    Maybe the following example will help:

    https://github.com/CaliLuke/NativeCo...iew/Picture.js

  5. #4
    Sencha User arindam.hit's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    99
    Answers
    1

    Default

    Thanks a lot. But taken image is storing in Device. How i can get the image and show in my application?
    Code:
    Ext.define('MyApp.view.CameraPanel', {    extend: 'Ext.Panel',
    
    
        config: {
            ui: 'light',
            layout: {
                type: 'card'
            },
            items: [
                {
                    xtype: 'button',
                    handler: function(button, event) {
                        Ext.device.Camera.capture({
                            source: 'camera',
                            destination: 'file',
    
    
                            success: function(url) {
                                this.fireEvent('change', this, url);
                            },
                            failure: function() {
                                Ext.Msg.alert('Error', 'There was an error when acquiring the picture.');
                            },
                            scope: this
                        });
                    },
                    height: 33,
                    left: 60,
                    top: 400,
                    ui: 'decline-round',
                    width: 200,
                    text: 'Take a Photo'
                }
            ]
        }
    
    
    });

  6. #5
    Sencha Premium Member akpotosufredrick's Avatar
    Join Date
    Jan 2011
    Posts
    69
    Answers
    4

    Default

    well since u have the url you can use that as your src in an image tag

  7. #6
    Sencha User
    Join Date
    May 2010
    Location
    Las Vegas, NV
    Posts
    134
    Answers
    7

    Default

    I have tried the example on GitHub as well as the Sencha Docs use of Ext.device.Camera.capture() and in all cases, the app just sits there. No success, no failure. I am testing this on an IOS 6 iPhone 4s, a Google Nexus 7 tablet, and my desktop browser.

    Any ideas?

  8. #7
    Sencha User arindam.hit's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    99
    Answers
    1

    Default

    Just follow this link:

    http://stackoverflow.com/questions/1...25855#13525855

    Hope it will work for you..

  9. #8
    Sencha User
    Join Date
    May 2010
    Location
    Las Vegas, NV
    Posts
    134
    Answers
    7

    Default

    That example does not work either.

    The camera never triggers on any of my devices.

    All that is happening is the stock Sencha image is displaying where I want the camera image to be.

    According to the docs, my scenario falls into the Simulation. What am I missing related to the Sencha Packager? I am running all this in Sencha Architect.

    Thanks.

  10. #9
    Sencha User arindam.hit's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    99
    Answers
    1

    Default

    So it means using the above code, camera application is not launching..and you are not able to capture any image..right??

  11. #10
    Sencha User arindam.hit's Avatar
    Join Date
    May 2012
    Location
    Hyderabad
    Posts
    99
    Answers
    1

    Default

    And can you please share your code part..so it will be easy understand..

Page 1 of 2 12 LastLast

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •