Expose file size and MIME to Lua

Use cases:
- size: Showing links (like to SVG validator) conditionally (e.g.
        only if the filesize is below the threshold it can work on)
- mime: No longer have to guess the MIME type based on the file
        extension. We use the MIME type for displaying correct and
        precise information about maximum thumbnailable sizes in
        case an uploaded work exceeds this limit.

This change will not have negative impact on performance; as soon
as width or height is loaded, the two newly added information are
gratis.

Change-Id: I25aad85c2a558a684aca83374aeb628f355fad1c
This commit is contained in:
rillke 2015-02-12 00:45:20 +01:00
parent f62b6b4379
commit fba298c26f

View file

@ -309,6 +309,8 @@ class Scribunto_LuaTitleLibrary extends Scribunto_LuaLibraryBase {
'exists' => true,
'width' => $file->getWidth(),
'height' => $file->getHeight(),
'mimeType' => $file->getMimeType(),
'size' => $file->getSize(),
'pages' => $pages
) );
}