×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2010
    Posts
    8

    Thumbs up How to get image dimensions using APIBridge.getMediaManagementService?

    Hi,
    I am developing Nokia (WRT) application using APIBridge.

    I have used getMediaManagementService() service of APIBridge, to fetch all the image objects from the phonegallery. The code is as follows..

    Code:
    var mms = APIBridge.getMediaManagementService();
    	var criteria = {
            sort: {
                key: "FileDate",
                order: "Descending"
            },
    		Type: "FileInfo",
    		Filter: {
    			FileType: "Image"
    		}
    	};
    	
    	mms.GetList(criteria, 
    		function(transId, eventCode, result) {
    			
    			if (hasError(result)){
    				return;
    			}
    			
    			result.ReturnValue.reset();
    			
    			image_gallery = [];
    			while ( image_obj = result.ReturnValue.getNext() ) {
    			      image_gallery.push(image_obj);
    			}
                   }
            );
    Every object in "image_gallery", it gets values for the following properties..

    FileName,
    FileExtension,
    Drive,
    FileSize,
    FileDate,
    FileNameAndPath,
    MimeType


    But unable to get the image dimensions (height and width), with which I have some logic to be implemented like.. I will not be accepting the images below certain values of height and width.

    Is there any function or service to get the image dimensions?

    Please help me out in geting those values of an image.
    --
    Suryapavan

    All of us do not have equal talent, but all of us should have an equal opportunity to develop our talent.

  2. #2
    Registered User
    Join Date
    Jul 2010
    Posts
    8

    Re: How to get image dimensions using APIBridge.getMediaManagementService?

    Actually I'm testing my app on 2 different mobiles.. E72 and N97

    1) E72 gets the following propertyNames for every image_gallery object.

    FileName,
    FileExtension,
    Drive,
    FileSize,
    FileDate,
    FileNameAndPath,
    MimeType


    2) N97 gets the following propertyNames for every image_gallery object.
    FileName,
    FileExtension,
    Drive,
    SongName,
    FileNameAndPath,
    MimeType


    And in both devices, only few of the images are being loaded when their FileNameAndPath was given in src of img tag. [ Something like <img src="'+image_gallery[i].FileNameAndPath+'" /> ]
    Unable to get the difference between 'loaded images' and 'the images not being loaded'.

    Please please please help me out from this issue
    Last edited by suryapavan; 2010-10-13 at 10:38.
    --
    Suryapavan

    All of us do not have equal talent, but all of us should have an equal opportunity to develop our talent.

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

    Re: How to get image dimensions using APIBridge.getMediaManagementService?

    Hello,

    You might wan't to check the thumbnail creation api as the images taken e.g with the camera are big.

    If you want to check the pixel size of an individual image you can get it by using JavaScript. The api bridge documentation does not mention way to do it.

    Code:
     
    var imageObj = new Image();
    imageObj.src= __imge_path__;
    
    imageObj.onload =  function(){
       document.body.innerHTML +=  imageObj.src +"<br>"+imageObj.width +" "+imageObj.height +"<br><br>"; 
    }
    Onload is because you cannot get the size until image is loaded, which takes some time of course.

    Have you checked the paths of the images that are not loading? For some reason I did spot some paths starting with file:// which i doubt will work. In addition if the image is in private folder then you cannot load it, but I doubt that such images are returned at all.

    -Ilkka
    Last edited by isalento; 2010-10-14 at 10:20. Reason: code tags

  4. #4
    Registered User
    Join Date
    Jul 2010
    Posts
    8

    Re: How to get image dimensions using APIBridge.getMediaManagementService?

    Hi Ilkka,
    Thanks for the reply...

    Yeah, I have checked the paths of all images (images those are loading and not). There is no problem in their paths, as their thumbnail is being displayed.
    But when i try to load the original image, those are not being loaded.

    Today, when I was testing again, I found that the images with size more than 640 KB are not being loading at all..! But this is the case in N97.
    When I checked in E72, the image with size 1.15 MB also loaded.. ( of-course, the images with size more than that din't load ).

    At this point I have few questions
    1) Is there any way to get the image's dimensions while we are fetching from the phone-gallery? If yes, I need not worry about loading them.. to get those values in JavaScript.
    2) Is there any difference in the APIBridge's getMediaManagementSerice() with different devices? (like .. N97 - E72). Coz, in the image objects I got in N97 mobile dint have the key "FileSize"

    Please clarify my doubts and help me out from this issue please
    --
    Suryapavan

    All of us do not have equal talent, but all of us should have an equal opportunity to develop our talent.

Similar Threads

  1. APIBridge
    By pcardoso in forum Symbian
    Replies: 4
    Last Post: 2010-09-22, 11:58
  2. Screen Dimensions
    By sanjayrajwani in forum Symbian User Interface
    Replies: 2
    Last Post: 2008-08-07, 16:12
  3. Image dimensions
    By dominic reeves in forum Mobile Java Media (Graphics & Sounds)
    Replies: 1
    Last Post: 2005-10-07, 09:44
  4. Image dimensions
    By dominic reeves in forum Symbian Media (Closed)
    Replies: 0
    Last Post: 2005-10-06, 21:14
  5. Image heap size & dimensions limit
    By lnx in forum Mobile Java General
    Replies: 0
    Last Post: 1970-01-01, 02:00

Posting Permissions

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