Bug 132407 - a gallery with two images whose names differ only in the extension give two identical thumbnails
Summary: a gallery with two images whose names differ only in the extension give two i...
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: kimgalleryplugin (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Lukáš Tinkl
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-08-14 19:42 UTC by Olivier Trichet
Modified: 2007-01-06 17:08 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
avoid thumbnails name clash (1.90 KB, patch)
2006-08-14 19:51 UTC, Olivier Trichet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Trichet 2006-08-14 19:42:20 UTC
Version:           3.5.3 (using KDE 3.5.3, Debian Package 4:3.5.3-1 (testing/unstable))

[ Imported from http://bugs.debian.org/382937 ]
When you generate a gallery with two images that differ only in the 
extension the two thumbnails are the same: there is only a thumbnail of 
one of the images. If the proportions of the two original images are 
different one of the thumbnails is shown distorted.

For example: take two images photo.gif and photo.jpg (the images have to 
be really different) and generate a gallery.
------

Self explanatory screenshot at :
http://bugs.debian.org/cgi-bin/bugreport.cgi/gallery1.jpg?bug=382937;msg=10;att=2 and http://bugs.debian.org/cgi-bin/bugreport.cgi/gallery.jpg?bug=382937;msg=10;att=1
Comment 1 Olivier Trichet 2006-08-14 19:51:49 UTC
Created attachment 17373 [details]
avoid thumbnails name clash

With this patch, the original file extension is no longer trimed. So that, for
example, photo.jpg and photo.gif can have their thumbnail (respectively
photo.jpg.jpg and photo.gif.jpg), instead of sharing photo.jpg and thumbnail's
name.
Comment 2 Martin Koller 2007-01-06 17:08:15 UTC
SVN commit 620556 by mkoller:

BUG: 132407

Don't trim filename extensions to avoid filename clash with two files
having the same name but different filetypes (extension)
Patch provided by Olivier Trichet


 M  +3 -4      imgalleryplugin.cpp  


--- branches/KDE/3.5/kdeaddons/konq-plugins/kimgalleryplugin/imgalleryplugin.cpp #620555:620556
@@ -202,8 +202,7 @@
 
 
             if (createThumb(imgName, sourceDirName, imgGalleryDir, imageFormat)) {
-                const QString imgNameFormat = imgName.left(imgName.findRev('.',-1));
-                const QString imgPath("thumbs/" + imgNameFormat + extension(imageFormat));
+                const QString imgPath("thumbs/" + imgName + extension(imageFormat));
                 stream << "<img src=\"" << imgPath << "\" width=\"" << m_imgWidth << "\" ";
                 stream << "height=\"" << m_imgHeight << "\" alt=\"" << imgPath << "\"/>";
                 m_progressDlg->setLabelText( i18n("Created thumbnail for: \n%1").arg(imgName) );
@@ -356,7 +355,7 @@
     // ..all the thumbnails ..
     for (uint i=0; i < imageDir.count(); i++) {
         const QString imgName = imageDir[i];
-        const QString imgNameFormat = imgName.left(imgName.findRev('.',-1)) + extension(imageFormat);
+        const QString imgNameFormat = imgName + extension(imageFormat);
         bool isRemoved = thumb_dir.remove(imgNameFormat);
         kdDebug(90170) << "removing: " << thumb_dir.path() << "/" << imgNameFormat << "; "<< isRemoved << endl;
     }
@@ -435,7 +434,7 @@
         KIO::NetAccess::copy(srcURL, destURL, static_cast<KParts::Part *>(parent())->widget());
     }
 
-    const QString imgNameFormat = imgName.left( imgName.findRev('.',-1) ) + extension(imageFormat);
+    const QString imgNameFormat = imgName + extension(imageFormat);
     const QString thumbDir = imgGalleryDir + QString::fromLatin1("/thumbs/");
     int extent = m_configDlg->getThumbnailSize();