[KPhotoAlbum] Checking image file readability by MIME type, rather than file name

Jesper K. Pedersen blackie at blackie.dk
Thu May 10 19:39:29 CEST 2007

I wonder if KImageIO::typeForMime is expensive - afterall it needs to read 
some of the file.

A solution might be to do something like:
return KImageIO::canRead(KImageIO::type(fileName)) || 
KImageIO::canRead(KImageIO::typeForMime(KImageIO::mimeType( fileName )))  ||  
ImageManager::ImageDecoder::mightDecode( fileName );

Thus first checking using the file name, and if that fails trying using the 
(presumeably) more expensive one.


On Thursday 10 May 2007, Shawn Willden wrote:
| Bug 136955 has a patch attached that seems like a good idea to me.  Can
| anyone think why it wouldn't?  Personally, I think it's a bad idea to have
| misnamed files, but if it's possible to handle it gracefully, why not do
| it?
| Here's the text of the bug report:
| files named pict000.jpg or Akademy2005.png etc. are imported correctly,
| even if they are wrongly named and in reality both image/tiff, but
| Sol-2002.01.04 or Judy.image are not (both image/png).
| And the patch is at:
| http://bugs.kde.org/attachment.cgi?id=18505&action=view
| 	Shawn.
| _______________________________________________
| KPhotoAlbum mailing list
| KPhotoAlbum at kdab.net
| http://mail.kdab.net/mailman/listinfo/kphotoalbum

Having trouble finding a given image in your collection containing
thousands of images?

http://www.kphotoalbum.org might be the answer.

More information about the KPhotoAlbum mailing list