limit size of downloaded backdrop based on screen size

This commit is contained in:
Luke Pulverenti 2013-05-15 10:12:24 -04:00
parent 6df3825ad5
commit ae74aaf421

View File

@ -1,4 +1,4 @@
var LibraryBrowser = (function (window, document, $) { var LibraryBrowser = (function (window, document, $, screen) {
var defaultBackground = "#999;"; var defaultBackground = "#999;";
@ -1448,11 +1448,16 @@
}, },
renderDetailPageBackdrop: function (page, item) { renderDetailPageBackdrop: function (page, item) {
var screenWidth = Math.max(screen.height, screen.width);
var imgUrl; var imgUrl;
if (item.BackdropImageTags && item.BackdropImageTags.length) { if (item.BackdropImageTags && item.BackdropImageTags.length) {
imgUrl = LibraryBrowser.getImageUrl(item, 'Backdrop', 0, {}); imgUrl = LibraryBrowser.getImageUrl(item, 'Backdrop', 0, {
maxwidth: screenWidth
});
$('#itemBackdrop', page).removeClass('noBackdrop').css('background-image', 'url("' + imgUrl + '")'); $('#itemBackdrop', page).removeClass('noBackdrop').css('background-image', 'url("' + imgUrl + '")');
@ -1462,7 +1467,8 @@
imgUrl = ApiClient.getImageUrl(item.ParentBackdropItemId, { imgUrl = ApiClient.getImageUrl(item.ParentBackdropItemId, {
type: 'Backdrop', type: 'Backdrop',
index: 0, index: 0,
tag: item.ParentBackdropImageTags[0] tag: item.ParentBackdropImageTags[0],
maxwidth: screenWidth
}); });
$('#itemBackdrop', page).removeClass('noBackdrop').css('background-image', 'url("' + imgUrl + '")'); $('#itemBackdrop', page).removeClass('noBackdrop').css('background-image', 'url("' + imgUrl + '")');
@ -1617,7 +1623,7 @@
}; };
})(window, document, jQuery); })(window, document, jQuery, screen);
(function (window, document, $) { (function (window, document, $) {