thumb images for episodes

This commit is contained in:
Ethan Pippin 2022-01-17 17:48:48 -07:00
parent 5ef57dc379
commit b67aa7a13e
4 changed files with 37 additions and 13 deletions

View File

@ -129,6 +129,16 @@ public extension BaseItemDto {
return URL(string: urlString)! return URL(string: urlString)!
} }
func getSeriesThumbImage(maxWidth: Int) -> URL {
let x = UIScreen.main.nativeScale * CGFloat(maxWidth)
let urlString = ImageAPI.getItemImageWithRequestBuilder(itemId: seriesId ?? "",
imageType: .thumb,
maxWidth: Int(x),
quality: 96,
tag: seriesPrimaryImageTag).URLString
return URL(string: urlString)!
}
func getPrimaryImage(maxWidth: Int) -> URL { func getPrimaryImage(maxWidth: Int) -> URL {
let imageType = ImageType.primary let imageType = ImageType.primary
var imageTag = imageTags?[ImageType.primary.rawValue] ?? "" var imageTag = imageTags?[ImageType.primary.rawValue] ?? ""

View File

@ -24,12 +24,15 @@ struct CinematicNextUpCardView: View {
ZStack(alignment: .bottomLeading) { ZStack(alignment: .bottomLeading) {
if item.itemType == .episode { if item.itemType == .episode {
ImageView(src: item.getSeriesBackdropImage(maxWidth: 350)) ImageView(sources: [
item.getSeriesThumbImage(maxWidth: 350),
item.getSeriesBackdropImage(maxWidth: 350),
])
.frame(width: 350, height: 210) .frame(width: 350, height: 210)
} else { } else {
ImageView(sources: [ ImageView(sources: [
item.getThumbImage(maxWidth: 320), item.getThumbImage(maxWidth: 350),
item.getBackdropImage(maxWidth: 320), item.getBackdropImage(maxWidth: 350),
], ],
bh: item.getBackdropImageBlurHash()) bh: item.getBackdropImageBlurHash())
.frame(width: 350, height: 210) .frame(width: 350, height: 210)

View File

@ -25,12 +25,15 @@ struct CinematicResumeCardView: View {
ZStack(alignment: .bottom) { ZStack(alignment: .bottom) {
if item.itemType == .episode { if item.itemType == .episode {
ImageView(src: item.getSeriesBackdropImage(maxWidth: 350)) ImageView(sources: [
item.getSeriesThumbImage(maxWidth: 350),
item.getSeriesBackdropImage(maxWidth: 350),
])
.frame(width: 350, height: 210) .frame(width: 350, height: 210)
} else { } else {
ImageView(sources: [ ImageView(sources: [
item.getThumbImage(maxWidth: 320), item.getThumbImage(maxWidth: 350),
item.getBackdropImage(maxWidth: 320), item.getBackdropImage(maxWidth: 350),
], ],
bh: item.getBackdropImageBlurHash()) bh: item.getBackdropImageBlurHash())
.frame(width: 350, height: 210) .frame(width: 350, height: 210)

View File

@ -27,13 +27,21 @@ struct ContinueWatchingView: View {
VStack(alignment: .leading) { VStack(alignment: .leading) {
ZStack { ZStack {
ImageView(sources: [ Group {
item.getThumbImage(maxWidth: 320), if item.itemType == .episode {
item.getBackdropImage(maxWidth: 320), ImageView(sources: [
], item.getSeriesThumbImage(maxWidth: 320),
bh: item.getBackdropImageBlurHash()) item.getSeriesBackdropImage(maxWidth: 320),
.frame(width: 320, height: 180) ])
.accessibilityIgnoresInvertColors() .frame(width: 320, height: 180)
} else {
ImageView(sources: [
item.getThumbImage(maxWidth: 320),
item.getBackdropImage(maxWidth: 320),
])
.frame(width: 320, height: 180)
}
}
HStack { HStack {
VStack { VStack {