本文整理汇总了C++中DllImageLib::CreateThumbnailFromMemory方法的典型用法代码示例。如果您正苦于以下问题:C++ DllImageLib::CreateThumbnailFromMemory方法的具体用法?C++ DllImageLib::CreateThumbnailFromMemory怎么用?C++ DllImageLib::CreateThumbnailFromMemory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DllImageLib
的用法示例。
在下文中一共展示了DllImageLib::CreateThumbnailFromMemory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateThumbnailFromMemory
bool CPicture::CreateThumbnailFromMemory(const unsigned char* buffer, int bufSize, const CStdString& extension, const CStdString& thumbFile)
{
CLog::Log(LOGINFO, "Creating album thumb from memory: %s", thumbFile.c_str());
DllImageLib dll;
if (!dll.Load()) return false;
if (!dll.CreateThumbnailFromMemory((BYTE *)buffer, bufSize, extension.c_str(), thumbFile.c_str(), g_advancedSettings.m_thumbSize, g_advancedSettings.m_thumbSize))
{
CLog::Log(LOGERROR, "%s: exception with fileType: %s", __FUNCTION__, extension.c_str());
return false;
}
return true;
}
示例2: CacheImage
bool CPicture::CacheImage(const CStdString& sourceUrl, const CStdString& destFile, int width, int height)
{
if (width > 0 && height > 0)
{
CLog::Log(LOGINFO, "Caching image from: %s to %s with width %i and height %i", sourceUrl.c_str(), destFile.c_str(), width, height);
DllImageLib dll;
if (!dll.Load()) return false;
if (URIUtils::IsInternetStream(sourceUrl, true))
{
CCurlFile http;
CStdString data;
if (http.Get(sourceUrl, data))
{
if (!dll.CreateThumbnailFromMemory((BYTE *)data.c_str(), data.GetLength(), URIUtils::GetExtension(sourceUrl).c_str(), destFile.c_str(), width, height))
{
CLog::Log(LOGERROR, "%s Unable to create new image %s from image %s", __FUNCTION__, destFile.c_str(), sourceUrl.c_str());
return false;
}
return true;
}
return false;
}
if (!dll.CreateThumbnail(sourceUrl.c_str(), destFile.c_str(), width, height, g_guiSettings.GetBool("pictures.useexifrotation")))
{
CLog::Log(LOGERROR, "%s Unable to create new image %s from image %s", __FUNCTION__, destFile.c_str(), sourceUrl.c_str());
return false;
}
return true;
}
else
{
CLog::Log(LOGINFO, "Caching image from: %s to %s", sourceUrl.c_str(), destFile.c_str());
return CFile::Cache(sourceUrl, destFile);
}
}