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

Tero Tilus tero at tilus.net
Thu May 10 21:12:52 CEST 2007


On Thu, 10 May 2007, Jesper K. Pedersen wrote:
> Thus first checking using the file name, and if that fails trying
> using the (presumeably) more expensive one.

Doesn't the hash calculation read whole the file?  Hash still has to
be calculated at least once per every file, so why not at the same
time find out (and save to db) the mime type too.  I assume these mime
magick things only need a couple hundred bytes from the beginnig, and
the data already is in cache after the hash calculation.

Finding out the mime type "for real" would (at least to me) sound like
KPA way to handle things.  At the final end we aren't really trusting
the file name/path to identify the file either.  ;)

-- 
Tero Tilus ## +358 (0)50 3635 235 ## http://www.tilus.net/koti/tero/


More information about the KPhotoAlbum mailing list