Summary: | imagegallery use irretating filenames foo.jpeg.jpeg for images | ||
---|---|---|---|
Product: | [Applications] digikam | Reporter: | Achim Bohnet <ach> |
Component: | Plugin-Generic-HTMLGallery | Assignee: | Digikam Developers <digikam-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | ana, caulier.gilles, wamukota |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 5.7.0 | |
Sentry Crash Report: |
Description
Achim Bohnet
2005-03-17 03:01:28 UTC
I have unforget it. If you have some free time, please take a look in the code and provide a simple patch to correct this ploblem. Gilles I have to check some duplicated here. I'm quite sure this problem is present in image gallery/html export batchprocess and cd archive (with html index). I don't know if we can have a patch for the incoming release, but I'm studying the problem. This bug is reported against 'imagesgallery'. This plugin has been replaced by a new plugin called 'HTMLExport', which is written completely from scratch. This bug report will now be closed. > This bug is reported against 'imagesgallery'. This plugin has been replaced
> by a new plugin called 'HTMLExport',
> which is written completely from scratch. This bug report will now be closed.
Toma this bug I believe is present yet either in html export or
in mpegecoder...
Angelo
reassigning *** Bug 128035 has been marked as a duplicate of this bug. *** according to bug #128035 (for IE) Can someone check if it is really a problem for IE new html gallery plugin? This plugin is changing the filename.ext into filename_ext. That should work, the only thing I'm not sure is as far as the page name concern e.g. filename_ext.jpeg.html, so please check if it is a problem. I found the problem reported here only for old html export plugin and cd archiver. (about this last I'm going to release a patch soon) Tested IMO the problem is only for cdarchive SVN commit 547624 by anaselli: Added webifyFileName (from html gallery) and moved png file from old imagesgallery plugin BUG: 101656 BUG: 128125 M +2 -0 Makefile.am M +39 -20 cdarchiving.cpp M +2 -0 cdarchiving.h AM gohome.png AM up.png AM valid-html401.png --- trunk/extragear/libs/kipi-plugins/cdarchiving/Makefile.am #547623:547624 @@ -25,3 +25,5 @@ kipiimagebrokenpicdir = $(kde_datadir)/kipi/data kipiimagebrokenpic_DATA = image_broken.png +kipiHTML401picdir = $(kde_datadir)/kipi +kipiHTML401pic_DATA = valid-html401.png gohome.png up.png --- trunk/extragear/libs/kipi-plugins/cdarchiving/cdarchiving.cpp #547623:547624 @@ -38,6 +38,7 @@ #include <qimage.h> #include <qtextcodec.h> #include <qtimer.h> +#include <qregexp.h> // Include files for KDE @@ -530,7 +531,7 @@ KIPI::ImageCollection album = *it; kdDebug( 51000 ) << "HTML Interface for Album: " << album.name() << endl; - m_AlbumTitle = album.name(); + m_AlbumTitle = webifyFileName(album.name()); m_AlbumComments = m_interface->hasFeature(KIPI::AlbumsHaveComments) ? album.comment() : QString(); m_AlbumCollection = m_interface->hasFeature(KIPI::AlbumsHaveCategory) ? @@ -793,15 +794,15 @@ { stream << "<tr>" << endl; } - + QString imgName = (*urlIt).fileName(); QString imgPath = (*urlIt).path(); QFileInfo imgInfo(imgPath); QImage imgProp = QImage(imgPath); - stream << "<td align='center'>\n<a href=\"pages/" << imgName << ".htm\">"; + stream << "<td align='center'>\n<a href=\"pages/" << webifyFileName(imgName) << ".htm\">"; kdDebug(51000) << "Creating thumbnail for " << imgName << endl; - + d = new KIPICDArchivingPlugin::EventData; d->action = KIPICDArchivingPlugin::ResizeImages; d->starting = true; @@ -809,13 +810,13 @@ d->fileName = imgName; QApplication::sendEvent(m_parent, new QCustomEvent(QEvent::User, d)); usleep(1000); - + int valRet = createThumb(imgName, (*urlIt).directory(), imgGalleryDir, imageFormat); - + if ( valRet != -1 ) { - QString thumbPath("thumbs/" + imgName + extension(imageFormat)); + QString thumbPath("thumbs/" + webifyFileName(imgName) + extension(imageFormat)); stream << "<img class=\"photo\" src=\"" << thumbPath << "\" width=\"" << m_imgWidth << "\" " @@ -1054,26 +1055,26 @@ const QDir pagesDir(imgGalleryDir + QString::fromLatin1("/pages/")); const QDir thumbsDir(imgGalleryDir + QString::fromLatin1("/thumbs/")); const QString imgName(imgURL.fileName()); - + // Html pages filenames const QString pageFilename = pagesDir.path() + QString::fromLatin1("/") + - imgName + + webifyFileName(imgName )+ QString::fromLatin1(".htm"); - const QString nextPageFilename = nextImgURL.fileName() + + const QString nextPageFilename = webifyFileName(nextImgURL.fileName()) + QString::fromLatin1(".htm"); - const QString prevPageFilename = prevImgURL.fileName() + + const QString prevPageFilename = webifyFileName(prevImgURL.fileName()) + QString::fromLatin1(".htm"); // Thumbs filenames const QString prevThumb = QString::fromLatin1("../thumbs/") + - prevImgURL.fileName() + + webifyFileName(prevImgURL.fileName()) + extension(m_imageFormat); const QString nextThumb = QString::fromLatin1("../thumbs/") + - nextImgURL.fileName() + + webifyFileName(nextImgURL.fileName()) + extension(m_imageFormat); QFile file( pageFilename ); @@ -1240,7 +1241,7 @@ // Create the thumbnails for the HTML interface. - const QString ImageNameFormat = imgName + extension(imageFormat); + const QString ImageNameFormat = webifyFileName(imgName) + extension(imageFormat); const QString thumbDir = imgGalleryDir + QString::fromLatin1("/thumbs/"); int extent = m_thumbnailsSize; @@ -1580,10 +1581,9 @@ QDir dir(dirname); dir.setFilter ( QDir::Dirs | QDir::Files | QDir::NoSymLinks ); - Temp = "<directory name=\"" - + EscapeSgmlText(QTextCodec::codecForLocale(), dir.dirName(), true, true) - + "\" >\n"; - + Temp = "<directory name=\"" + + EscapeSgmlText(QTextCodec::codecForLocale(), dir.dirName(), true, true) + + "\" >\n"; *stream << Temp; kdDebug( 51000 ) << "Directory: " << dir.dirName().latin1 () << endl; @@ -1650,12 +1650,17 @@ kdDebug( 51000 ) << "Adding Collection: " << collection.name() << endl; QString Temp; + QString collection_name; + if (m_useHTMLInterface) + collection_name = webifyFileName(collection.name()); + else + collection_name = collection.name(); Temp = "<directory name=\"" - + EscapeSgmlText(QTextCodec::codecForLocale(), collection.name(), true, true) + + EscapeSgmlText(QTextCodec::codecForLocale(), collection_name, true, true) + "\" >\n"; *stream << Temp; - + KURL::List images = collection.images(); for (KURL::List::iterator it = images.begin(); @@ -1853,6 +1858,20 @@ return strReturn; } + +/** + * Produce a web-friendly file name + */ + +QString CDArchiving::webifyFileName(QString fileName) { + fileName=fileName.lower(); + + // Remove potentially troublesome chars + fileName=fileName.replace(QRegExp("[^-0-9a-zA-Z]+"), "_"); + + return fileName; +} + } // NameSpace KIPICDArchivingPlugin #include "cdarchiving.moc" --- trunk/extragear/libs/kipi-plugins/cdarchiving/cdarchiving.h #547623:547624 @@ -201,6 +201,8 @@ void writeSettings(void); void readSettings(void); + + QString webifyFileName(QString fileName); }; } // NameSpace KIPICDArchivingPlugin ** trunk/extragear/libs/kipi-plugins/cdarchiving/gohome.png #property svn:mime-type + application/octet-stream ** trunk/extragear/libs/kipi-plugins/cdarchiving/up.png #property svn:mime-type + application/octet-stream ** trunk/extragear/libs/kipi-plugins/cdarchiving/valid-html401.png #property svn:mime-type + application/octet-stream digiKam core has a new HTML Gallery tool which do not have this problem. Gilles Caulier |