Support webp image output

This commit is contained in:
Luke Pulverenti 2014-08-28 00:32:45 -04:00
parent 68973b901a
commit 046e584924
2 changed files with 17 additions and 1 deletions

View File

@ -345,7 +345,9 @@ h1 .imageLink {
}
.page > .ui-content {
padding-bottom: 120px;
/* Need this so that the audio player doesn't cover content, but also for unveil lazy loading. */
padding-bottom: 160px;
}
.dashboardPanelDivider {

View File

@ -2122,6 +2122,12 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
});
};
function supportsWebP() {
// TODO: Improve with http://webpjs.appspot.com/
return $.browser.chrome || $.browser.android;
}
function normalizeImageOptions(options) {
var ratio = window.devicePixelRatio || 1;
@ -2147,6 +2153,10 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
}
options.quality = options.quality || (options.type.toLowerCase() == 'backdrop' ? 80 : 90);
if (supportsWebP()) {
options.format = 'webp';
}
}
/**
@ -2220,6 +2230,10 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
delete options.type;
delete options.index;
if (supportsWebP()) {
options.format = 'webp';
}
return self.getUrl(url, options);
};