You Are Here:

Community: Wiki

This page was last modified 07:40, 22 August 2007.

How to retrieve image thumbnails in S60 3rd Edition?

From Forum Nokia Wiki

Description

In S60 2nd Edition, CAPAlbImageUtil class provides GetThumbnailL() method to get thumbnails for images saved in the Gallery. In S60 3rd Edition, the Photo Album API has been removed and is replaced by the Media Gallery API, which does not provide any method for directly accessing image thumbnails.

Solution

As a workaround, it is possible to scan the Images folder for thumbnails.

The directory path for thumbnails is in the following format:

<DRIVE>:\ Data \ Images \ _PAlbTN \

In Nokia Nseries devices, the directory structure used for Gallery is different from other devices:

<DRIVE>:\ Data \ Images \ <YearMonth> \ _PAlbTN \ <R1XR2> \

where R1 and R2 are device-specific resolutions. There may be multiple versions (resolutions) of the same thumbnail.

Note: The _PAlbTN directory is marked as hidden.

To make the code work in all S60 3rd Edition devices, you have to do a recursive search in all the subfolders of the image folder to find the thumbnail of the image.

Usually, thumbnails will use the same file name as the main image file, but a different extension. For example, if the image file name is some_picture.jpg, then the thumbnail will be named some_picture.jpg_170x128.

RFs fs;
 
        User::LeaveIfError(fs.Connect());
 
        CleanupClosePushL(fs);              
 
        // assumes phone memory is used for storing images
 
        _LIT( KImagesPath, "C:\\Data\\Images\\" );        
 
        // to list known image file(s) and thumbnail(s), use imagename.ext*
 
        // to list thumbnail(s) only for a known image, use imagename.ext_*
 
        // to list all available images and thumbnails, use *.*        
 
        _LIT(KImageName,"some_picture.jpg*");         
 
        CDirScan* scan = CDirScan::NewLC( fs );        
 
        scan->SetScanDataL( KImagesPath, 
 
                            KEntryAttNormal|KEntryAttHidden, 
 
                            ESortNone, 
 
                            CDirScan::EScanDownTree );    
 
        FOREVER
 
            {
 
            CDir* dirlis = 0;
 
            TRAPD(error, scan->NextL(dirlis));
 
            if (error || !dirlis)
 
                {            
 
                break;
 
                }
 
            delete dirlis;
 
            FindFile( fs, scan->FullPath(), KImageName );
 
            };            
 
        CleanupStack::PopAndDestroy(2); // scan, fs        
 
    void FindFile( RFs& aFs, const TDesC& aDir, const TDesC& aImageWild )
 
        {
 
        CDir* dirList;
 
        TFindFile FindObj( aFs );
 
        TInt j = FindObj.FindWildByDir( aImageWild, aDir, dirList );                
 
        if( j == KErrNone )
 
            {
 
            for ( TInt i = 0; i < dirList->Count() ; i++ )
 
                {
 
                TFileName fullname(aDir);             
 
                fullname.Append((*dirList)[i].iName);                
 
                // fullname now contains path and name of image/thumbnail           
 
                }
 
            }
 
        }

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditFurlTechnocratiMagnoliaTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia 
RDF Facets: qdcZidentifierQSxhttpE3aE2fE2fwikiE2eforumE2enokiaE2ecomE2findeE78E2ephpE2fHowE5ftoE5fgetE5ftheE5fCurrentE5fOrientationX qdcZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qdcZtypeQUqfnTypeZCommunityContentQ qdcZtypeQUqfnTypeZE52esourceQ qdcZtypeQUqfnTypeZWebpageQ qdcZtypeQUqfnTypeZWikiContentQ qdcZtypeQUqmarsZManagedE52esourceQ qdcZtypeQUqwebZInformationE52esourceQ qdcZtypeQUqwebZPageQ qdcZtypeQUqwebZE52esourceQ qdcZtypeQUqrdfsZE52esourceQ qfnZtopicQUqfnTopicZseriesE5f60Q qfnZtypeQUqfnTypeZCommunityContentQ qfnZtypeQUqfnTypeZE52esourceQ qfnZtypeQUqfnTypeZWebpageQ qfnZtypeQUqfnTypeZWikiContentQ qfnZuserE5ftagQSxs60X qmarsZlanguageQUxhttpE3aE2fE2fswE2enokiaE2ecomE2flanguageE2d1E2fenX qrdfZtypeQUqfnZE45E78cludedFromGeneralE4cistingsQ qrdfZtypeQUqfnTypeZCommunityContentQ qrdfZtypeQUqfnTypeZE52esourceQ qrdfZtypeQUqfnTypeZWebpageQ qrdfZtypeQUqfnTypeZWikiContentQ qrdfZtypeQUqmarsZManagedE52esourceQ qrdfZtypeQUqwebZInformationE52esourceQ qrdfZtypeQUqwebZPageQ qrdfZtypeQUqwebZE52esourceQ qrdfZtypeQUqrdfsZE52esourceQ