×

Discussion Board

Results 1 to 15 of 20

Hybrid View

  1. #1
    Registered User
    Join Date
    Jan 2012
    Posts
    28

    How to obtain the number of bytes of a photo taken by "startCamera"

    I know that I can use "startCamera" to take a photo.

    I want to know immediately the number of bytes of the photo (before saving it), for example, 63278 bytes.

    How to do this?

    Thank you for your hint !!!

  2. #2
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: How to obtain the number of bytes of a photo taken by "startCamera"

    Hi,

    Behind the scenes, startCamera starts camera uses media management API to check new images, which were taken in time between startCamera call and user exiting camera app.
    So Images are already stored, before startCamera call returns.

    Afterwards you can use media management API to check file info.
    http://www.developer.nokia.com/Resou...anagement.html
    See FileSize in table "Returned media information"
    http://www.developer.nokia.com/Resou...getlist-2.html

    Br,
    Ilkka

  3. #3
    Registered User
    Join Date
    Jan 2012
    Posts
    28

    Re: How to obtain the number of bytes of a photo taken by "startCamera"

    thank you, isalento, i will carefully see these pages.

  4. #4
    Registered User
    Join Date
    Jan 2012
    Posts
    28

    Re: How to obtain the number of bytes of a photo taken by "startCamera"

    Using the following codes, my WRT app can take a photo. very good!

    My problem is: how to immediately obtain the number of bytes of the taken photo? for example, 69703 bytes. What command/method/property should I use?

    Thank you very much for your helpful hint !!!

    ------------------------------------------------------

    function onFail(err)
    { alert("failed"); }

    function onSuccess(pic_array)
    { alert("successful");
    // how to obtain the number of bytes of the taken photo??? }

    var so = nokia.device.load("camera");
    var ret = so.startCamera(onSuccess, onFail);

  5. #5
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: How to obtain the number of bytes of a photo taken by "startCamera"

    Hi,

    In the previous post I encouraged to take look into Platform Services Media Management API. However there is even simpler solution available.
    This on requires adding one line to platformservices.js library.

    Open platformservices.js and goto line 3850. You should see something like below there.

    Code:
    var _246={};
    _246.height=item.XPixels;
    _246.width=item.YPixels;
    _246.type=item.MimeType;
    //added
    _246.size = item.FileSize
    Then just add _246.size = item.FileSize as a last item.

    After this change, you can access the size data in camera onSuccess callback.
    Code:
    var formatData = picture_array[i].format;		
    var data = "Mime: " + formatData.type + "\nWidth: " + formatData.width + "\nHeight: " + formatData.height+"Size"+ formatData.size;
    Br,
    Ilkka

  6. #6
    Registered User
    Join Date
    Jan 2012
    Posts
    28

    Re: How to obtain the number of bytes of a photo taken by "startCamera"

    Thank you, isalento! This is what I need!

    Unfortunately, when I run this code, I see:

    successful
    total: 0


    but I don't see:

    size: ??????

    Can you kindly tell me why? Thank you again!

    ----------------------------------------------------

    function onSuccess(pic_array)
    { var formatData, sizedata;
    var total = pic_array.length;

    alert("successful");
    alert("total: " + total + "");

    for (var i = 0; i < total; i++)
    { formatData = pic_array[i].format;
    sizedata = "size: " + formatData.size;
    alert(sizedata); } }

  7. #7
    Nokia Developer Expert
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

    Re: How to obtain the number of bytes of a photo taken by "startCamera"

    Did you add "_246.size = item.FileSize" to platformservices.js?

    -Ilkka

  8. #8
    Registered User
    Join Date
    Jan 2012
    Posts
    28

    Re: How to obtain the number of bytes of a photo taken by "startCamera"

    YES!!! Added!!!

Similar Threads

  1. Replies: 0
    Last Post: 2008-02-27, 02:16
  2. send sms from a "TEXT" and not a "NUMBER"
    By cha0s4u in forum General Messaging
    Replies: 6
    Last Post: 2007-01-18, 04:27
  3. Replies: 2
    Last Post: 2006-10-04, 15:58

Posting Permissions

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