From f37faadcf10b1dba683b7fe3250dba6a3066bbde Mon Sep 17 00:00:00 2001 From: chrox Date: Sun, 17 Aug 2014 17:39:03 +0800 Subject: [PATCH] ImageWidget now supports png, jpg and tiff files --- frontend/ui/widget/imagewidget.lua | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/frontend/ui/widget/imagewidget.lua b/frontend/ui/widget/imagewidget.lua index 37e302229..c0c0420bf 100644 --- a/frontend/ui/widget/imagewidget.lua +++ b/frontend/ui/widget/imagewidget.lua @@ -18,10 +18,11 @@ local ImageWidget = Widget:new{ function ImageWidget:_render() local itype = string.lower(string.match(self.file, ".+%.([^.]+)") or "") - if itype == "jpeg" or itype == "jpg" then - self._bb = Image:fromJPEG(self.file) - elseif itype == "png" then - self._bb = Image:fromPNG(self.file) + if itype == "png" or itype == "jpg" or itype == "jpeg" + or itype == "tiff" then + self._bb = Image:fromFile(self.file, self.width, self.height) + else + error("Image file type not supported.") end local w, h = self._bb:getWidth(), self._bb:getHeight() if (self.width and self.width ~= w) or (self.height and self.height ~= h) then