share-extras / media-viewers

Enhanced document previews for a range of different document and media types, plus a dashlet allowing any content item to be displayed on a site dashboard.
Apache License 2.0
29 stars 23 forks source link

Add srcMaxSize option to viewers #16

Closed wabson closed 10 years ago

wabson commented 11 years ago

Similar to the built-in Image plugin, the Media Viewers plugins should support checking the file size of the source file, allowing administrators to configure a maximum file size beyond which the viewer will not be used.

wabson commented 11 years ago

Example code from Image.js

var srcMaxSize = this.attributes.srcMaxSize;
if (!this.attributes.src && srcMaxSize.match(/^\d+$/) && this.wp.options.size > parseInt(srcMaxSize))
{
    // File is too big
}