[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: [kde-linux] grumble about konqueror image gallery change
From:       James Richard Tyrer <tyrerj () acm ! org>
Date:       2007-10-31 1:05:00
Message-ID: 4727D4BC.3050300 () acm ! org
[Download RAW message or body]

david wrote:
> James Richard Tyrer wrote:
>> david wrote:
>>> <grumble>
>>>
>>> For some reason, awhile back, the Konqueror image gallery plugin 
>>> decided to give the thumbnails double file extensions 
>>> (filename.jpg.jpg). When I went to report this at the kde.org bug 
>>> database, I found it had already been reported and marked as WONTFIX 
>>> because the developer decided for some utterly irrational reason to 
>>> no longer have the plugin trim off the file extension before naming 
>>> the thumb. That bug report said something about avoiding filename 
>>> clashes, but the thumbnails are put into a separate thumbs folder, so 
>>> there's no possible filename clash to avoid!
>>>
>>> Anyway, when I tried to provide a comment to that effect, the kde.org 
>>> bug database gave me an error and invited me to contact the webmaster 
>>> with the date/time and info. Forget it. The server's already recorded 
>>> the date/time and logged the error, so forget it.
>>>
>>> </grumble>
>>>
>>> And my wife's laptop with PCLinuxOS got GIMP 2.4 last week during 
>>> update, and my laptop with Debian is still stuck with 2.2 ...
>>>
>>> Sorry for grumbles, just needed to get it off the to do list!
>>>
>> Could you please provide me with some more specific information?
>>
>> Which function in this in Konqueror?  Is it:
>>
>>     View -> View Mode -> Photobook
> 
> Tools > Create Image Gallery
> 
>> What bug number is it?
> 
> http://bugs.kde.org/show_bug.cgi?id=142002
> 
> I see it's also been reported again, as a wishlist item, so I tossed 
> five votes at it. Maybe someone will listen.
> 
>> Exactly where do these double extensions show up?
> 
> They show up in the names of the generated thumbnails. Inside the folder 
> containing the full size images, it creates a folder called thumbs. 
> Inside that folder, it puts the generated thumbnails. So if you made an 
> image gallery from imagefile1.jpg, it creates a file named 
> imagefile1.jpg.jpg in the thumbs folder.
> 
> I understand their rationale, but I think it should be a configurable 
> option.
> 
I find that this isn't related to KView (which I adopted) but I looked
at it anyway.

He has a point that somebody might be stupid enough to have files with
the same name and different extensions which were not different aspects
of the same data.  That is if you have the same exact image stored in
two different formats, there is no problem since the thumbnails would be
the same.

However, you are correct that there shouldn't be two extensions when the
file type has only one.  So, I would suggest that if we are going to use
the same format with thumbnails with matching names that the "." in the
original file should be replaced with a "_" which is a more normal practice.

This is fairly easy to fix.  I don't know why he wasn't willing to do so.

-- 
JRT


["kimgalleryplugin.svn-diff" (text/plain)]

Index: imgalleryplugin.cpp
===================================================================
--- imgalleryplugin.cpp	(revision 729969)
+++ imgalleryplugin.cpp	(working copy)
@@ -188,6 +188,7 @@ void KImGalleryPlugin::createBody(QTextS
     int imgIndex;
     QFileInfo imginfo;
     QPixmap  imgProp;
+    QString imgNameFormat;
     for (imgIndex = 0; !m_cancelled && (imgIndex < numOfImages);) {
         stream << "<tr>" << endl;
 
@@ -200,9 +201,8 @@ void KImGalleryPlugin::createBody(QTextS
                 stream << "<td align='center'>\n<a href=\"" << imgName << "\">";
             }
 
-
-            if (createThumb(imgName, sourceDirName, imgGalleryDir, imageFormat)) {
-                const QString imgPath("thumbs/" + imgName + extension(imageFormat));
+            if (createThumb(imgName, imgNameFormat, sourceDirName, imgGalleryDir, \
imageFormat)) { +                const QString imgPath("thumbs/" + imgNameFormat);
                 stream << "<img src=\"" << imgPath << "\" width=\"" << m_imgWidth << \
                "\" ";
                 stream << "height=\"" << m_imgHeight << "\" alt=\"" << imgPath << \
                "\"/>";
                 m_progressDlg->setLabelText( i18n("Created thumbnail for: \
\n%1").arg(imgName) ); @@ -420,9 +420,15 @@ void KImGalleryPlugin::loadCommentFile()
     }
 }
 
-bool KImGalleryPlugin::createThumb( const QString& imgName, const QString& \
                sourceDirName,
-                                    const QString& imgGalleryDir, const QString& \
imageFormat) +bool KImGalleryPlugin::createThumb( const QString& imgName, QString& \
imgNameFormat, const QString& sourceDirName, const QString& imgGalleryDir, const \
QString& imageFormat)  {
+
+    int imgDot = 0;
+    QString thumbName = imgName;
+	while ( (imgDot = thumbName.find( '.', imgDot )) >= 0 ) {
+	    thumbName = thumbName.replace( (uint) imgDot, 1, '_' );
+        }
+
     QImage img;
     const QString pixPath = sourceDirName + QString::fromLatin1("/") + imgName;
 
@@ -434,7 +440,7 @@ bool KImGalleryPlugin::createThumb( cons
         KIO::NetAccess::copy(srcURL, destURL, static_cast<KParts::Part \
*>(parent())->widget());  }
 
-    const QString imgNameFormat = imgName + extension(imageFormat);
+    imgNameFormat = thumbName + extension(imageFormat);
     const QString thumbDir = imgGalleryDir + QString::fromLatin1("/thumbs/");
     int extent = m_configDlg->getThumbnailSize();
 
Index: imgalleryplugin.h
===================================================================
--- imgalleryplugin.h	(revision 729969)
+++ imgalleryplugin.h	(working copy)
@@ -68,7 +68,7 @@ class KImGalleryPlugin : public KParts::
   void createCSSSection(QTextStream& stream);
   void createBody(QTextStream& stream, const QString& sourceDirName, const \
QStringList& subDirList, const QDir& imageDir, const KURL& url, const QString& \
imageFormat);  
-  bool createThumb( const QString& imgName, const QString& sourceDirName, const \
QString& imgGalleryDir, const QString& imageFormat); +  bool createThumb( const \
QString& imgName, QString& imgNameFormat, const QString& sourceDirName, const \
QString& imgGalleryDir, const QString& imageFormat);  
   bool createHtml( const KURL& url, const QString& sourceDirName, int \
recursionLevel, const QString& imageFormat);  void deleteCancelledGallery( const \
KURL& url, const QString& sourceDirName, int recursionLevel, const QString& \
imageFormat);



>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic