×

Discussion Board

Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Registered User
    Join Date
    Jan 2012
    Posts
    28

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

    By the way, when I run my codes, I see "security warning" three times.

    I don't want to see them. Can I disable the security warning?

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

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

    Well there are couple of options, both of which are not perfect:
    Root problems lies in platformservices.js in line 3842:
    Code:
    var d=new Date(Date.parse(item.FileDate)); //fails to parse localized timestamp
    if(d>__sp_camera_start_date){ }
    Workarounds:
    1)
    Implement your own parseFunction, that is able to parse item.FileDate, that is in Chinese to JavaScript Date object.
    var d=new Date(myOwnParseFunction(item.FileDate));
    For starters you could print out item.FileDate to see the format and then make a script to parse it.

    2)
    Get rid of the date comparison altogether and just use the first image that is returned. In this case user may be confused, if she/he didn't take the image, but just closed the app.
    This one is easier to implement, but can cause bad UX. One option would be to use media management api to retrieve list before calling take picture, and then compare the list to one retrieved after resuming to widget. However this would in practice mean writing your own camera functionality.

    Br,
    Ilkka

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

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

    THANX !!!!!

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

    Last problem: I use the following line to display a photo

    document.getElementById("photo").src = photo_array[photo_array.length - 1].uri;

    but the photo can't be displayed until I manually refresh the webpage.

    How to automatically refresh the photo?

  4. #19
    Nokia Developer Moderator
    Join Date
    Jun 2008
    Location
    Tampere
    Posts
    833

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

    The last problem is most likely due to fact, that pictures taken with the camera are huge. Changing the camera resolution to smallest one should help with this problem.

    Better option is to use Platform services 2.0 media management API to get thumbnail of the image.

    Code:
    // global service object
    var thumbso;
    
    // ErrorCallback function
    function errorCB(err)
    {
        alert("ErrorCode: " + err.code + " ErrorMessage: " + err.message);
    }
    
    // callback function
    function showThumb(uri){ 
    	document.getElementById("photo").src = uri;
    }
    function getThumb(image_uri){
    	try {
    	    thumbso = nokia.device.load("media");
    		 alert(image_uri);
    		 
    		 image_uri = image_uri.substring(8, image_uri.length); //strip file:///
    		 image_uri = "file://"+image_uri;
    		   
    		var thumb={
    			uri: image_uri,
    			size:{
    				width: 200,
    				height: 150
    			}			
    		}
    	
    	    var transactionId = thumbso.getThumbnail(showThumb, thumb, errorCB);	    
    	}
    	catch(e) {
    	    alert(e);
    	}
    }
    Br,
    Ilkka

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

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

    Hi,
    One more update.
    I wrote a wiki article about taking the image and retrieving a thumbnail.
    http://www.developer.nokia.com/Commu...2.0_Camera_API

    In process of writing the example app, I ran into a problem in acquiring the latest image. I always got the second last image. I traced this back into native camera app launching logic and managed to fix it by tweaking platformservices.js. You might want to check those changes, from the example app, attached in the wiki article.

    Br,
    Ilkka

Page 2 of 2 FirstFirst 12

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
  4. "Restricted by max. size in bytes, 4-way scrollable"
    By fraperry in forum Mobile Web Site Development
    Replies: 3
    Last Post: 2005-11-18, 10:52

Posting Permissions

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