Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements to the quality of artworks and user images - Part 2 #512

Merged
merged 4 commits into from
Oct 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- [lewazo](https://github.com/lewazo)
- [Raghu Saxena](https://github.com/ckcr4lyf)
- [Nickbert7](https://github.com/Nickbert7)
- [ferferga](https://github.com/ferferga)

# Emby Contributors

Expand Down
3 changes: 1 addition & 2 deletions src/components/activitylog.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ define(["events", "globalize", "dom", "datetime", "userSettings", "serverNotific
if (entry.UserId && entry.UserPrimaryImageTag) {
html += '<i class="listItemIcon md-icon" style="width:2em!important;height:2em!important;padding:0;color:transparent;background-color:' + color + ";background-image:url('" + apiClient.getUserImageUrl(entry.UserId, {
type: "Primary",
tag: entry.UserPrimaryImageTag,
height: 40
tag: entry.UserPrimaryImageTag
}) + "');background-repeat:no-repeat;background-position:center center;background-size: cover;\">dvr</i>"
} else {
html += '<i class="listItemIcon md-icon" style="background-color:' + color + '">' + icon + '</i>';
Expand Down
15 changes: 0 additions & 15 deletions src/components/backdrop/backdrop.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,6 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
currentLoadingBackdrop = instance;
}

var standardWidths = [480, 720, 1280, 1440, 1920];
function getBackdropMaxWidth() {
var width = dom.getWindowSize().innerWidth;
var roundScreenTo = 100;

if (standardWidths.indexOf(width) !== -1) {
return width;
}

width = Math.floor(width / roundScreenTo) * roundScreenTo;
return Math.min(width, 1920);
}

function getItemImageUrls(item, imageOptions) {
imageOptions = imageOptions || {};

Expand All @@ -195,7 +182,6 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
return apiClient.getScaledImageUrl(item.BackdropItemId || item.Id, Object.assign(imageOptions, {
type: "Backdrop",
tag: imgTag,
maxWidth: getBackdropMaxWidth(),
index: index
}));
});
Expand All @@ -206,7 +192,6 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'css!./style']
return apiClient.getScaledImageUrl(item.ParentBackdropItemId, Object.assign(imageOptions, {
type: "Backdrop",
tag: imgTag,
maxWidth: getBackdropMaxWidth(),
index: index
}));
});
Expand Down
5 changes: 3 additions & 2 deletions src/components/cardbuilder/card.css
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,10 @@ button {
left: 0;
right: 0;
bottom: 0;
background-size: contain;
background-size: cover;
background-repeat: no-repeat;
background-position: center bottom;
background-position: center;
border: none;
}

.cardImage-img {
Expand Down
23 changes: 0 additions & 23 deletions src/components/cardbuilder/cardBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -471,63 +471,55 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana

imgUrl = apiClient.getScaledImageUrl(item.Id, {
type: "Thumb",
maxWidth: width,
tag: item.ImageTags.Thumb
});

} else if ((options.preferBanner || shape === 'banner') && item.ImageTags && item.ImageTags.Banner) {

imgUrl = apiClient.getScaledImageUrl(item.Id, {
type: "Banner",
maxWidth: width,
tag: item.ImageTags.Banner
});

} else if (options.preferDisc && item.ImageTags && item.ImageTags.Disc) {

imgUrl = apiClient.getScaledImageUrl(item.Id, {
type: "Disc",
maxWidth: width,
tag: item.ImageTags.Disc
});

} else if (options.preferLogo && item.ImageTags && item.ImageTags.Logo) {

imgUrl = apiClient.getScaledImageUrl(item.Id, {
type: "Logo",
maxWidth: width,
tag: item.ImageTags.Logo
});

} else if (options.preferLogo && item.ParentLogoImageTag && item.ParentLogoItemId) {

imgUrl = apiClient.getScaledImageUrl(item.ParentLogoItemId, {
type: "Logo",
maxWidth: width,
tag: item.ParentLogoImageTag
});

} else if (options.preferThumb && item.SeriesThumbImageTag && options.inheritThumb !== false) {

imgUrl = apiClient.getScaledImageUrl(item.SeriesId, {
type: "Thumb",
maxWidth: width,
tag: item.SeriesThumbImageTag
});

} else if (options.preferThumb && item.ParentThumbItemId && options.inheritThumb !== false && item.MediaType !== 'Photo') {

imgUrl = apiClient.getScaledImageUrl(item.ParentThumbItemId, {
type: "Thumb",
maxWidth: width,
tag: item.ParentThumbImageTag
});

} else if (options.preferThumb && item.BackdropImageTags && item.BackdropImageTags.length) {

imgUrl = apiClient.getScaledImageUrl(item.Id, {
type: "Backdrop",
maxWidth: width,
tag: item.BackdropImageTags[0]
});

Expand All @@ -537,7 +529,6 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana

imgUrl = apiClient.getScaledImageUrl(item.ParentBackdropItemId, {
type: "Backdrop",
maxWidth: width,
tag: item.ParentBackdropImageTags[0]
});

Expand All @@ -547,8 +538,6 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana

imgUrl = apiClient.getScaledImageUrl(item.Id, {
type: "Primary",
maxHeight: height,
maxWidth: width,
tag: item.ImageTags.Primary
});

Expand All @@ -569,8 +558,6 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana

imgUrl = apiClient.getScaledImageUrl(item.PrimaryImageItemId || item.Id || item.ItemId, {
type: "Primary",
maxHeight: height,
maxWidth: width,
tag: item.PrimaryImageTag
});

Expand All @@ -589,15 +576,13 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana

imgUrl = apiClient.getScaledImageUrl(item.ParentPrimaryImageItemId, {
type: "Primary",
maxWidth: width,
tag: item.ParentPrimaryImageTag
});
}
else if (item.SeriesPrimaryImageTag) {

imgUrl = apiClient.getScaledImageUrl(item.SeriesId, {
type: "Primary",
maxWidth: width,
tag: item.SeriesPrimaryImageTag
});
}
Expand All @@ -607,8 +592,6 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana

imgUrl = apiClient.getScaledImageUrl(item.AlbumId, {
type: "Primary",
maxHeight: height,
maxWidth: width,
tag: item.AlbumPrimaryImageTag
});

Expand All @@ -623,7 +606,6 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana

imgUrl = apiClient.getScaledImageUrl(item.Id, {
type: "Thumb",
maxWidth: width,
tag: item.ImageTags.Thumb
});

Expand All @@ -632,39 +614,34 @@ define(['datetime', 'imageLoader', 'connectionManager', 'itemHelper', 'focusMana

imgUrl = apiClient.getScaledImageUrl(item.Id, {
type: "Backdrop",
maxWidth: width,
tag: item.BackdropImageTags[0]
});

} else if (item.ImageTags && item.ImageTags.Thumb) {

imgUrl = apiClient.getScaledImageUrl(item.Id, {
type: "Thumb",
maxWidth: width,
tag: item.ImageTags.Thumb
});

} else if (item.SeriesThumbImageTag && options.inheritThumb !== false) {

imgUrl = apiClient.getScaledImageUrl(item.SeriesId, {
type: "Thumb",
maxWidth: width,
tag: item.SeriesThumbImageTag
});

} else if (item.ParentThumbItemId && options.inheritThumb !== false) {

imgUrl = apiClient.getScaledImageUrl(item.ParentThumbItemId, {
type: "Thumb",
maxWidth: width,
tag: item.ParentThumbImageTag
});

} else if (item.ParentBackdropImageTags && item.ParentBackdropImageTags.length && options.inheritThumb !== false) {

imgUrl = apiClient.getScaledImageUrl(item.ParentBackdropItemId, {
type: "Backdrop",
maxWidth: width,
tag: item.ParentBackdropImageTags[0]
});

Expand Down
9 changes: 4 additions & 5 deletions src/components/emby-button/emby-button.css
Original file line number Diff line number Diff line change
Expand Up @@ -147,15 +147,14 @@
vertical-align: middle;
}

.paper-icon-button-light > img {
width: 1.72em;
/* Can't use 100% height or it will stretch past the boundaries in safari */
/*height: 100%;*/
.paper-icon-button-light > div {
max-height: 100%;
/* Make sure its on top of the ripple */
transform: scale(1.8);
position: relative;
z-index: 1;
vertical-align: middle;
display: inline;
margin: 0 auto;
}

.emby-button-foreground {
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/dashboardpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ define(["datetime", "events", "itemHelper", "serverNotifications", "dom", "globa
html += "</div>";
html += '<div class="flex align-items-center justify-content-center">';
var userImage = DashboardPage.getUserImage(session);
html += userImage ? '<img style="height:1.71em;border-radius:50px;margin-right:.5em;" src="' + userImage + '" />' : '<div style="height:1.71em;"></div>';
html += userImage ? '<div class="activitylogUserPhoto" style="background-image:url(\'' + userImage + "');\"></div>" : '<div style="height:1.71em;"></div>';
html += '<div class="sessionUserName">';
html += DashboardPage.getUsersHtml(session);
html += "</div>";
Expand Down
7 changes: 0 additions & 7 deletions src/controllers/itemdetailpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,31 +429,24 @@ define(["loading", "appRouter", "layoutManager", "connectionManager", "cardBuild
detectRatio = !1;
imageTags.Primary ? (url = apiClient.getScaledImageUrl(item.Id, {
type: "Primary",
maxHeight: 460,
tag: item.ImageTags.Primary
}), detectRatio = !0) : item.BackdropImageTags && item.BackdropImageTags.length ? (url = apiClient.getScaledImageUrl(item.Id, {
type: "Backdrop",
maxHeight: 360,
tag: item.BackdropImageTags[0]
}), shape = "thumb") : imageTags.Thumb ? (url = apiClient.getScaledImageUrl(item.Id, {
type: "Thumb",
maxHeight: 360,
tag: item.ImageTags.Thumb
}), shape = "thumb") : imageTags.Disc ? (url = apiClient.getScaledImageUrl(item.Id, {
type: "Disc",
maxHeight: 360,
tag: item.ImageTags.Disc
}), shape = "square") : item.AlbumId && item.AlbumPrimaryImageTag ? (url = apiClient.getScaledImageUrl(item.AlbumId, {
type: "Primary",
maxHeight: 360,
tag: item.AlbumPrimaryImageTag
}), shape = "square") : item.SeriesId && item.SeriesPrimaryImageTag ? url = apiClient.getScaledImageUrl(item.SeriesId, {
type: "Primary",
maxHeight: 360,
tag: item.SeriesPrimaryImageTag
}) : item.ParentPrimaryImageItemId && item.ParentPrimaryImageTag && (url = apiClient.getScaledImageUrl(item.ParentPrimaryImageItemId, {
type: "Primary",
maxHeight: 360,
tag: item.ParentPrimaryImageTag
})), html += '<div style="position:relative;">', editable && (html += "<a class='itemDetailGalleryLink' is='emby-linkbutton' style='display:block;padding:2px;margin:0;' href='#'>"), detectRatio && item.PrimaryImageAspectRatio && (item.PrimaryImageAspectRatio >= 1.48 ? shape = "thumb" : item.PrimaryImageAspectRatio >= .85 && item.PrimaryImageAspectRatio <= 1.34 && (shape = "square")), html += "<img class='itemDetailImage lazy' src='data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=' />", editable && (html += "</a>");
var progressHtml = item.IsFolder || !item.UserData ? "" : indicators.getProgressBarHtml(item);
Expand Down
5 changes: 2 additions & 3 deletions src/controllers/user/profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ define(["controllers/userpasswordpage", "loading", "libraryMenu", "apphost", "em
var imageUrl = "img/logindefault.png";
if (user.PrimaryImageTag) {
imageUrl = ApiClient.getUserImageUrl(user.Id, {
height: 200,
tag: user.PrimaryImageTag,
type: "Primary"
});
}

var userImage = page.querySelector("#image");
userImage.src = imageUrl;
userImage.style.backgroundImage = "url(" + imageUrl + ")";

Dashboard.getCurrentUser().then(function (loggedInUser) {
if (user.PrimaryImageTag) {
Expand Down Expand Up @@ -71,7 +70,7 @@ define(["controllers/userpasswordpage", "loading", "libraryMenu", "apphost", "em
reader.onerror = onFileReaderError;
reader.onabort = onFileReaderAbort;
reader.onload = function (evt) {
userImage.src = evt.target.result;
userImage.style.backgroundImage = "url(" + evt.target.result + ")";
var userId = getParameterByName("userId");
ApiClient.uploadUserImage(userId, "Primary", file).then(function () {
loading.hide();
Expand Down
10 changes: 10 additions & 0 deletions src/css/dashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,16 @@ div[data-role=controlgroup] a.ui-btn-active {
width: 100% !important
}

.activitylogUserPhoto {
height:1.71em;
width:1.71em;
border-radius:100%;
margin-right:.5em;
background-size:cover;
background-repeat:no-repeat;
background-position:center;
}

@media all and (min-width:40em) {
.activeSession {
width: 100% !important
Expand Down
7 changes: 5 additions & 2 deletions src/css/librarybrowser.css
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,12 @@
display: inline-block
}

.headerUserButtonRound img {
.headerUserButtonRound div {
-webkit-border-radius: 100em;
border-radius: 100em
border-radius: 100em;
background-size: cover;
background-repeat: no-repeat;
background-position: center center;
}

.headerButton {
Expand Down
2 changes: 1 addition & 1 deletion src/myprofile.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="padded-left padded-right padded-bottom-page">
<div class="readOnlyContent" style="margin: 0 auto; padding: 0 1em;">
<div style="position:relative;display:inline-block;max-width:200px;">
<img id="image" width="200px" />
<div id="image" style="width:200px;height:200px;background-repeat:no-repeat;background-position:center;border-radius:100%;background-size:cover;"></div>
<input id="uploadImage" type="file" accept="image/*" style="position:absolute;right:0;width:100%;height:100%;opacity:0;" />
</div>
<div style="vertical-align:top;margin:1em 2em;display:inline-block;">
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/librarymenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ define(["dom", "layoutManager", "inputManager", "connectionManager", "events", "
function updateHeaderUserButton(src) {
if (src) {
headerUserButton.classList.add("headerUserButtonRound");
headerUserButton.innerHTML = '<img src="' + src + '" />';
headerUserButton.innerHTML = '<div class="headerButton headerButtonRight paper-icon-button-light headerUserButtonRound" style="background-image:url(\'' + src + "');\"></div>";
} else {
headerUserButton.classList.remove("headerUserButtonRound");
headerUserButton.innerHTML = '<i class="md-icon">&#xE7FD;</i>';
Expand Down