[Digikam-devel] [Bug 119946] thumbnails not correctly rotated according to exif information
Gilles Caulier
caulier.gilles at free.fr
Sat May 27 11:48:18 BST 2006
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
http://bugs.kde.org/show_bug.cgi?id=119946
------- Additional Comments From caulier.gilles free fr 2006-05-27 12:48 -------
SVN commit 545326 by cgilles:
digikam from stable: always use thumbnails generated by digiKam kio slave, not kde thumbnails generator.
CCBUGS: 119946, 123742
M +14 -10 digikamthumbnail.cpp
--- branches/stable/extragear/graphics/digikam/kioslave/digikamthumbnail.cpp #545325:545326
@ -21,6 +21,8 @
* ============================================================ */
#define XMD_H
+#define PNG_BYTES_TO_CHECK 4
+#define DigiKamFingerPrint "Digikam Thumbnail Generator"
// Qt Includes.
@ -139,8 +141,6 @
thumb = thumb.xForm( matrix );
}
-#define PNG_BYTES_TO_CHECK 4
-
static QImage loadPNG(const QString& path)
{
png_uint_32 w32, h32;
@ -264,9 +264,8 @
}
int sizeOfUint = sizeof(unsigned int);
- for (i = 0; i < h; i++)
- lines[i] = ((unsigned char *)(qimage.bits())) +
- (i * w * sizeOfUint);
+ for (i = 0 ; i < h ; i++)
+ lines[i] = ((unsigned char *)(qimage.bits())) + (i * w * sizeOfUint);
png_read_image(png_ptr, lines);
free(lines);
@ -274,7 +273,8 @
png_textp text_ptr;
int num_text=0;
png_get_text(png_ptr,info_ptr,&text_ptr,&num_text);
- while (num_text--) {
+ while (num_text--)
+ {
qimage.setText(text_ptr->key,0,text_ptr->text);
text_ptr++;
}
@ -288,7 +288,7 @
}
kio_digikamthumbnailProtocol::kio_digikamthumbnailProtocol(int argc, char** argv)
- : SlaveBase("kio_digikamthumbnail", argv[2], argv[3])
+ : SlaveBase("kio_digikamthumbnail", argv[2], argv[3])
{
argc_ = argc;
argv_ = argv;
@ -331,11 +331,15 @
error(KIO::ERR_INTERNAL, i18n("File does not exist"));
return;
}
+
+ // NOTE: if thumbnail have not been generated by digiKam (konqueror for example),
+ // force to recompute it, else we use it.
img = loadPNG(thumbPath);
if (!img.isNull())
{
- if (img.text("Thumb::MTime") == QString::number(st.st_mtime))
+ if (img.text("Thumb::MTime") == QString::number(st.st_mtime) &&
+ img.text("Software") == QString(DigiKamFingerPrint))
regenerate = false;
}
@ -382,9 +386,9 @
if (exif)
exifRotate(url.path(), img);
- img.setText(QString("Thumb::URI").latin1(), 0, uri);
+ img.setText(QString("Thumb::URI").latin1(), 0, uri);
img.setText(QString("Thumb::MTime").latin1(), 0, QString::number(st.st_mtime));
- img.setText(QString("Software").latin1(), 0, QString("Digikam Thumbnail Generator"));
+ img.setText(QString("Software").latin1(), 0, QString(DigiKamFingerPrint));
KTempFile temp(thumbPath + "-digikam-", ".png");
if (temp.status() == 0)
More information about the Digikam-devel
mailing list