Cexif::~Cexif()
{
- //ClearExif();
}
void Cexif::ClearExif()
}
}
-bool Cexif::DecodeExif(const char *filename)
+bool Cexif::DecodeExif(const char *filename, int Thumb)
{
FILE * hFile = fopen(filename, "r");
if(!hFile) return false;
m_exifinfo = new EXIFINFO;
memset(m_exifinfo,0,sizeof(EXIFINFO));
freeinfo = true;
+ m_exifinfo->Thumnailstate = Thumb;
m_szLastError[0]='\0';
ExifImageWidth = MotorolaOrder = SectionsRead=0;
ProcessExifDir(SubdirStart, OffsetBase, ExifLength, m_exifinfo, LastExifRefdP);
}
- if (ThumbnailSize && ThumbnailOffset)
+ if (ThumbnailSize && ThumbnailOffset && m_exifinfo->Thumnailstate)
{
if (ThumbnailSize + ThumbnailOffset <= ExifLength)
{
- m_exifinfo->ThumbnailPointer = OffsetBase + ThumbnailOffset;
- m_exifinfo->ThumbnailSize = ThumbnailSize;
+ if(FILE *tf = fopen(THUMBNAILTMPFILE, "w"))
+ {
+ fwrite( OffsetBase + ThumbnailOffset, ThumbnailSize, 1, tf);
+ fclose(tf);
+ m_exifinfo->Thumnailstate = 2;
+ }
}
}