Home || Visual Search || Applications || Architecture || Important Messages || OGL || Src

Array2dVec3UInt8* Impala::Application::MediaTable::RemoteRetriever::RetrieveImageData ( std::string  url,
bool  fromCache = true,
bool  toCache = true 
) [inline]

Definition at line 36 of file RemoteRetriever.h.

References Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CH(), Impala::Core::Array::Array2dTem< StorT, elemSize, ArithT >::CW(), Impala::FileExists(), ILOG_DEBUG, ILOG_ERROR, ILOG_WARN, mCachePrefix, mUseCache, Impala::Core::Array::ReadJpgFromMemory(), and Impala::Application::MediaTable::RemoteRetriever::RemoteFileRetriever::target.

Referenced by Impala::Application::MediaTable::TableDataSourceFlickrPhotoList::GetImageDataByID().

00036                                                                                                    {
00037                 if(!mUseCache) fromCache = toCache = false;
00038 
00039                 Array2dVec3UInt8* imageData = 0;
00040 
00041 #ifndef WIN32
00042                 if((toCache || fromCache) && !FileExists(mCachePrefix))
00043                 {
00044                         ILOG_WARN("Cache folder does not exists, continuing without cache");
00045                         toCache = fromCache = false;
00046                 }
00047 #endif
00048 
00049                 std::string filename = mCachePrefix + url.substr(url.find_last_of('/')+1);
00050         RemoteFileRetriever retriever = RemoteFileRetriever(url, fromCache, toCache, filename);
00051                 retriever();
00052 
00053                 if(retriever.target.size() < 512)
00054                 {
00055                         ILOG_ERROR("Image is smaller than 512 bytes, skipping.");
00056                         return 0;
00057                 }
00058 
00059                 ILOG_DEBUG("Trying to ReadJpg from " << &retriever.target << " with size " << retriever.target.size());
00060 #ifdef USE_BOOST_THREAD
00061                 {
00062                         boost::mutex::scoped_lock lock(mutex_readjpg);
00063                         Core::Array::ReadJpgFromMemory(imageData, (char*) retriever.target.c_str(), retriever.target.size());
00064                 }
00065 #else
00066                 Core::Array::ReadJpgFromMemory(imageData, (char*) retriever.target.c_str(), retriever.target.size());
00067 #endif
00068 
00069                 if(imageData != 0)
00070                         ILOG_DEBUG("Returning image data of " << imageData->CW() << "x" << imageData->CH() <<" pixels at " << imageData);
00071         return imageData;
00072     }

Here is the call graph for this function:


Generated on Thu Jan 13 09:15:24 2011 for ImpalaSrc by  doxygen 1.5.1