@@ -38,7 +38,7 @@ import Data.Bits
3838-- quick and dirty functions to get image sizes
3939-- algorithms borrowed from wwwis.pl
4040
41−data ImageType = Png | Gif | Jpeg deriving Show
41+data ImageType = Png | Gif | Jpeg | Pdf deriving Show
4242
4343data ImageSize = ImageSize{
4444 pxX :: Integer
@@ -53,6 +53,7 @@ imageType img = case B.take 4 img of
5353 "\x89\x50\x4e\x47" -> return Png
5454 "\x47\x49\x46\x38" -> return Gif
5555 "\xff\xd8\xff\xe0" -> return Jpeg
56+ "%PDF" -> return Pdf
5657 _ -> fail "Unknown image type"
5758
5859imageSize :: ByteString -> Maybe ImageSize
@@ -62,6 +63,7 @@ imageSize img = do
6263 Png -> pngSize img
6364 Gif -> gifSize img
6465 Jpeg -> jpegSize img
66+ Pdf -> Nothing -- TODO
6567
6668sizeInPixels :: ImageSize -> (Integer, Integer)
6769sizeInPixels s = (pxX s, pxY s)