mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
ImageWidget now supports png, jpg and tiff files
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user