×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Regular Contributor
    Join Date
    Nov 2003
    Posts
    145

    loading images from device's image folder

    hi all,

    I am developing an application where I need to load the image from the device's "Image" folder and then to display those image in a Grid List.

    1) how do I access the images from "device's image" folder ?
    2) after getting the images will they have to be converted in .bmp format and stored in .mbm file?


    regards
    dotcdotc

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142
    1) you can find the images usually in :/nokia/images/- or /images/ folders from both C: (phone) & E: (MMC) drives.

    the phone has very mush same style file system as your MS windows has.

    2) Why ? what is your plan, with the images ? what do you wanna do with them ?

    yucca

  3. #3
    Regular Contributor
    Join Date
    Nov 2003
    Posts
    145

    loading images from device's image folder

    symbianyucca, thanks for responding

    1) You are right that I can access imgaes from "c:\nokia\images"

    2) I just want to take the image from the device itself (typically c:\nokia\images) and then to use them in a GridList.

    later I would like open that image according to the selection made in the list.


    I hope this would clear my question.

    regards
    dotcdotc

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142
    would it be easier just to use CPAlbImageFetchPopupList instead ?

    yucca

  5. #5
    Regular Contributor
    Join Date
    Nov 2003
    Posts
    145

    loading images from device's image folder

    hi yucca,

    I write the following code:

    CPAlbImageData* data = CPAlbImageData::NewL();
    CleanupStack::PushL(data);
    TBool result = CPAlbImageFetchPopupList::RunL(data);
    CleanupStack::PopAndDestroy();

    its woring fine on emulaotr, it shows me a dialog box where from I can make further selection but this is not being diplayed on my Nokia 7610.

    But its not sufficient for what I am doing.

    what I want to do is

    I have a a Grid List that will be populated dynamically by the images resides in "c:\Nokia\images" folder.

    or u can say I am creating my own "image viewer"

    now I am extending my question.

    As images are in JPEG format on device but to be displayed in my GridList , do I need to convert them in Bitmap format?

    regards
    dotcdotc

  6. #6
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142
    you should rather use the thumbnails associated with the images, since the opening of the jpg images can take several seconds each.

    yucca

  7. #7
    Regular Contributor
    Join Date
    Nov 2003
    Posts
    145

    loading images from device's image folder

    hi yucca,

    I am back again to discuss more problems with u.

    1) Photo Album APIs r deprecated. As I want to run my application on 7610(symbian 7.0s) and other new models so that is of no use.

    2) I am trying to use ICL (Image Convertor Library) wihch is pretty hard to use, atleast for a naive like me.

    now I am able to convert thumbnails (in JPEG format) into bitmaps but really have no idea how to add these converted bitmaps or icons to my Grid List dynamically.

    yucca, your help and suggestions are highly appreciated.

    regards
    dotcdotc

  8. #8
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142
    you basically need to make icons out of them and add then into your grid, by using set icon array, something like this:

    CArrayPtr<CGulIcon>* icons =new( ELeave ) CAknIconArray(2);

    icons->AppendL(MyIcon);

    iGridView->ItemDrawer()->FormattedCellData()->SetIconArrayL(icons);

    you could also use CEikonEnv::Static() pointer, and make your icons using one of these two functions:

    CreateIconL() or CreateIconFromMaskedBitmapL()

    yucca

  9. #9
    Regular Contributor
    Join Date
    Nov 2003
    Posts
    145

    loading images from device's image folder

    yucca, thanks again for u r quick response.

    well, your solution is right if I am taking icons from resource file. But here case is bit complicated, actually I need to load converted images to the list at runtime. following is what I am doing :

    1) loading images (in jpeg format) thumbanails from "C:\Nokia\images\_PAlbTN" folder on device (its 7610)

    2) converting them into bitmaps using ICL (Image Converter Library)

    3)------- STUCKED --------------- as now I have bitmaps, but have no idea abt how to load these bitmaps in my Grid List list.

    regards
    dotcdotc

  10. #10
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142
    in case you are showing the image thumbnails, they are basically mbm format (all thou the extension suggest othervise), so you could use CreateIconL() function to make icon from them directly.

    Also check the SDK docs of how you could make icons from bitmaps.

    yucca

  11. #11
    Regular Contributor
    Join Date
    Nov 2003
    Posts
    145

    loading images from device's image folder

    yucca, this what I have done.....

    I am sending u my code. I am just trying to create icons and putting them up in "icons" array.

    ////////////////////////////////////////////////////////////

    void CICMView::PopulateListL()
    {
    TInt count; //will contains no. of files

    //create a session
    RFs session;
    User::LeaveIfError(session.Connect());

    //construct a TFIndFile object
    TFindFile file_finder(session);

    //define the directry where from icons has to be taken
    CDir* dir;
    _LIT(KWildName,"*.jpg");
    _LIT(KScanDir,"C:\\Nokia\\Images\\_PAlbTN");

    const TDesC* ptr = &KScanDir;
    TInt err = file_finder.FindWildByPath(KWildName, ptr, dir);
    count = dir->Count();

    CArrayPtr<CGulIcon>* icons = new (ELeave) CAknIconArray(count);
    CleanupStack::PushL(icons);

    //set the no. of cells in GridList
    for (TInt i=0; i<count; i++)
    {
    TParse fullEntry;
    fullEntry.Set( (* dir) [i].iName, & file_finder.File(), NULL);
    const TDesC16 fname = fullEntry.FullName();

    /**********its working fine till this point*********/


    //following statement is causing problem. My emulator simple gets closed

    CGulIcon* icon = iEikonEnv->CreateIconL(fname, 0, 0);

    /**************whats wrong with above statement ?******************/



    CleanupStack::PushL(icon);
    icons->AppendL(icon);
    CleanupStack::PopAndDestroy(icon);
    }
    delete dir;
    CleanupStack::PopAndDestroy(icons);

    //close the session
    session.Close();
    }
    ////////////////////////////////////////////////////////////////////////
    regards
    dotcdotc

  12. #12
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142
    I would check that the name used there is ok first, then I would check if the iEikonEnv is really non-NULL.

    Also check that there is no-dirs in the folder, so you are not trying to open a dir as a mbm.

    Othervise, I cant really see what could be wrong with the code.

    yucca

  13. #13
    Regular Contributor
    Join Date
    Nov 2003
    Posts
    145

    loading images from device's image folder

    yucca, I have got confused in using iEiokonEnv->CreateIconL() function. This function expects three arguments

    1) its expects an MBM file as first argument while I am passing a thumbnail which has extension .jpg.

    2) index of image in MBM. (So I don't know what to pass there because I dont have MBM file)

    3) index of mask bitmap in MBM (again no MBM so no index).


    confused !!!

    regards
    dotcdotc

  14. #14
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,142
    yep, the first argument is the file name with full path, that also includes the drive.

    The second is the bitmap index, zero is always good, since it is the first image on mbm.

    The mask is used to mask areas that will be shown from the image, and other areas are showing the background with the icon.

    Anyway, you could also construct the icons directly using CGulIcon, and load the image with the pointer returned by Bitmap() -function. With it you could leave the mask as NULL, so it wouldn't be used when drawing the icon.

    yucca

  15. #15
    Regular Contributor
    Join Date
    Nov 2003
    Posts
    145

    loading images from device's image folder

    hi yucca,

    first of all thankyou very much for your support.

    but after a lont try I am still not able to do what I have mentioned earlier.

    finally, can u give me (if possible), a small working code, taking a thumbnail and displaying it in a Grid List, but without using Photo Album APIs.

    I shall be very thankfull to you.

    regards
    dotcdotc

Page 1 of 2 12 LastLast

Posting Permissions

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