Tizen Developers

Menu
Sites
Language
Bug ImageContentInfo Construct method

Hello

result Construct (const Tizen::Base::String *pContentPath)

This mothod does not work. It has compability issue in sdk 2.0

 

[E_INVALID_ARG] The contentPath should start with /Media or /Storagecard/Media(/opt/usr/media/Camera/20130629_204749.jpg).

So it only works with bada media path and does not work with tizen media path
Has it been solved in sdk 2.1 or upcoming 2.2?

 

The idea is to use the Camera appControl to capture image and then get the image content info for futher editing/moving/deleting..

 

void MyApp::OnAppControlCompleteResponseReceived(
        const AppId &appId, const Tizen::Base::String &operationId,
        const Tizen::App::AppCtrlResult appControlResult,
        const Tizen::Base::Collection::IMap* pResultList) {

    String *pImageSource = (String*) pResultList->GetValue(
                        String(L"path"));

    ImageContentInfo imageContentInfo;
    result r = imageContentInfo.Construct( pImageSource->GetPointer());
    //Here it will fail

}
Edited on 18 03, 2014

Responses

7 Replies
john Smith
Hi, I have used below code snippet AppLog("Enter to ContentInfo "); result r = E_SUCCESS; ImageContentInfo pImagecontInfo; r = pImagecontInfo.Construct(filepath); AppLog(GetErrorMessage(r)); and for filepath i have used FileManager AppControl, its working for me.Kindly check with this.
Zoltan Puski
Hi Nour, why are you using 2.0? Slowly 2.1 becoming old too :)
john Smith
Hi, I am using 2.1 SDK. OnAppControlCompleteResponseReceived for (int i=0; iGetCount(); i++) { String* pValue = dynamic_cast(pValueList->GetAt(i)); AppLog("FilePath is %ls",pValue->GetPointer()); ContentInfo(pValue); } // Code for ContentInfo() ContentInfo(const Tizen::Base::String* filepath) { AppLog("Enter to ContentInfo "); result r = E_SUCCESS; ImageContentInfo pImagecontInfo; r = pImagecontInfo.Construct(filepath); AppLog(GetErrorMessage(r)); return r; }
john Smith
Hi, While you are constructing this method at that time you are passing a pointer ,imageContentInfo.Construct( *pImageSource); But the path which you are getting storing in pointer instance, again you are passing pointer in construct method, it is like double pointer for which it is not working. use only imageContentInfo.Construct( pImageSource);
john Smith
Hi, You are right, even i am also do this but i am not able to get Name of content. I have used some different code snippet. ContentSearch search; result r = search.Construct(CONTENT_TYPE_IMAGE); if (IsFailed(r)) { AppLog("~~~ Construct error: %s", GetErrorMessage(r)); } // Call SearchN() of ContentSearch as the first page int pageNo = 1; int countPerPage = 5; int totalPage = 0; int totalCount = 0; IList* pContentInfoList = search.SearchN(pageNo, countPerPage, totalPage, totalCount, L"", L"", SORT_ORDER_NONE); if (IsFailed(GetLastResult())) { AppLog("~~~ SearchN error: %s", GetErrorMessage(GetLastResult())); } for(int i = 0; i < pContentInfoList->GetCount(); i++) { ContentSearchResult *pRes = static_cast (pContentInfoList->GetAt(i)); ImageContentInfo *pContInf1 = static_cast(pRes->GetContentInfo()); // ContentInfo *pContInf =pRes->GetContentInfo(); UuId contentid = pContInf1 ->GetContentId(); String str = contentid.ToString(); AppLog("~~~ id: %ls", str.GetPointer()); AppLog("~~~ Name: %ls", pContInf1->GetContentName().GetPointer()); AppLog("~~~ Path: %ls", pContInf1->GetContentPath().GetPointer()); } In OnActionPerformed(), i am able to get the content Id and path name but name i am not getting.
john Smith
hi, Use below code snippet You have to create content first, after that only you can fetch the information String contentPath(Environment::GetMediaPath() + L"Sounds/test.mp3"); AudioContentInfo audioContentInfo; r = audioContentInfo.Construct(&contentPath); if (IsFailed(r)) { AppLog("Fail!!! Exception : %s", GetErrorMessage(r)); } r = audioContentInfo.SetContentName(L"Test Content Name"); if (IsFailed(r)) { AppLog("Fail!!! Exception : %s", GetErrorMessage(r)); } ContentManager contentManager; r = contentManager.Construct(); if (IsFailed(r)) { AppLog("Fail!!! Exception : %s", GetErrorMessage(r)); } ContentId tempId = contentManager.CreateContent(audioContentInfo); r = GetLastResult(); if (IsFailed(r)) { AppLog("Fail!!! Exception : %s", GetErrorMessage(r)); } AudioContentInfo* pContentInfo = (AudioContentInfo*)contentManager.GetContentInfoN(tempId); r = GetLastResult(); if (IsFailed(r)) { AppLog("Fail!!! Exception : %s", GetErrorMessage(r)); } String contentName = pContentInfo->GetContentName(); AppLog("contentName : %ls", contentName.GetPointer()); String mimeType = pContentInfo->GetMimeType(); AppLog("mimeType : %ls", mimeType.GetPointer()); ContentId contentId = pContentInfo->GetContentId(); AppLog("contentId : %ls", contentId.ToString().GetPointer()); String genre = pContentInfo->GetGenre(); AppLog("genre : %ls", genre.GetPointer()); String title = pContentInfo->GetTitle(); AppLog("title : %ls", title.GetPointer());
john Smith
Hi Nour, First of all when you have to copy the file from source path to dest path right. For this you need to create a content for this using CreateContent(). But the source path is always application project path, you can't select the path from opt/usr/media/Camera. Its either GetAppRootPath or ExternalStoragePath(). For more information https://developer.tizen.org/help/index.jsp?topic=%2Forg.tizen.native.apireference%2FclassTizen_1_1Content_1_1ContentManager.html The way you are approaching, i think its little bit complex. From content you are fetching the file and copying the file.