-
-
Notifications
You must be signed in to change notification settings - Fork 222
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
imageUtils rewrite #769
imageUtils rewrite #769
Conversation
SonarCloud Quality Gate failed.
|
Codecov Report
@@ Coverage Diff @@
## master #769 +/- ##
==========================================
- Coverage 68.44% 67.36% -1.08%
==========================================
Files 24 24
Lines 786 806 +20
Branches 141 144 +3
==========================================
+ Hits 538 543 +5
- Misses 228 243 +15
Partials 20 20
Continue to review full report at Codecov.
|
fdb78b4
to
4ab6186
Compare
4ab6186
to
0a32806
Compare
v-if="item.ImageTags && item.ImageTags.Primary" | ||
:item="item" | ||
/> | ||
<v-icon v-else size="128" dark>mdi-account</v-icon> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not do this fallback on BlurhashImage like all the items does?
BlurhashImage also has slots now, no need for v-else
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
576fdf1 fixes this by using slots properly in blurhash-image
(There's no need to make a condition, you define the default content by putting it into the slot)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a clue why this is happening. Maybe we can make the v-if
here an v-if-else
? I don't have a idea why this is happening, we're already getting artist images with proper icons in the home header.
I originally placed the condition so BlurhashImage is smart enough to provide icons for fallbacks but we're still able to pass our own custom slots in case we needed a different component or other needs.
You shouldn't need those slots in any case, I'm testing your changes locally to see what could be going on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, something strange iis going on. Master is showing me the mid-account
icon for artists that don't have an image in the Home Header. Your PR shows the mdi-disc
icon instead.
Artists that have images don't have any overlapping icon, so I think you should remove the passed slots altogether and let BlurhashImage handle it like we do in HomeHeader's master and artist cards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't have a clue why this is happening. Maybe we can make the v-if here an v-if-else? I don't have a idea why this is happening, we're already getting artist images with proper icons in the home header.
That part of the code is completely gone.
The way you define a slot's default content isn't with v-if and v-else, but by putting the default inside of the slot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need those slots in any case, I'm testing your changes locally to see what could be going on.
I removed the ones for the main artist and person images.
However one still remains in PersonList. In order to remove it, we should rework getShapeFromItemType
to take BaseItemDto | BaseItemPerson
. But that touches stuff outside of this PR's scope, so I'd rather do it in a followup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, something strange iis going on. Master is showing me the
mid-account
icon for artists that don't have an image in the Home Header. Your PR shows themdi-disc
icon instead.
It has always showed mdi-disc
in the home header for me, since the home header lists albums, not persons.
<v-fade-transition> | ||
<img | ||
v-show="!loading" | ||
:key="`blurhashimage-${item.Id}`" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does this work when the component is not remounted? (I.e item update or audio controls)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It works just fine for me.
The logic in this is the exact same as what the web client does, so whatever it uses for images is what this uses too. If that's not the case for mixed libraries, there may be changes needed elsewhere, which would probably fall under another PR :/ |
Web is using thumb images. Movies have always used Primary and TV Shows in the past few versions moved to Primary but the mixed were left behind. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
15df72e
to
0446328
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirm that there aren't issues while switching between tracks in audiocontrols (with a caveat, see review comments).
The issues with people (only tested music artists) I commented in my other review persist though:
(We expect album covers now or artist images?)
Also, in some places artists has images and in some other they don't:
However, in other item "You may also like":
There are some other cases where the image is present in the library cards but not in the artist page:
I found this happens when you're navigating from a place where the image doesn't exist as well. So, if I click in the library card, I can see the image. However, if I find that artist through "You may also like", there are no images. Same applies with home header and I guess to every place where the image isn't displayed correctly. Following links in albums to artist also reproduce this problem
<template #placeholder> | ||
<v-icon size="16">mdi-account</v-icon> | ||
</template> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need this? If you want to override the sizing, you can pass iconSize
prop to BlurhashImage, the rest (component type being icon, icon that will be used) is exactly the same output that BlurhashImage will generate for you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because this doesn't use BaseItemDto, but BaseItemPerson.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MrTimscampi Shouldn't we then instruct BlurhashImage to handle those? Right now they don't have a blurhash as well because this. As you moved everything to a single function in imageHelper I guess this should be possible without much hassle.
I'd rather we get it merged without this as the placeholder mess is very difficult to maintain and having everything centered (like image rescaling on resize, the fallbacks and so on) in blurhashimage turned out to be great in the long term (this PR would have been massive for instance :P)
<v-avatar color="card"> | ||
<blurhash-image :item="relatedItem" icon-size="16" /> | ||
</v-avatar> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Above you want exactly what you do here
this.onError(); | ||
} | ||
this.image = imageInfo.url; | ||
this.tag = imageInfo.tag ? imageInfo.tag : 'no-image-tag'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not set it to null instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Holdover from jf-web, thanks for catching it 😋
maxWidth: 96 | ||
}) || '', | ||
this.getImageInfo(this.getCurrentItem, { | ||
width: 96 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should define in all these functions the height to be 100% sure that the size we get is the one we really expect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The server won't cut them if we specify the height too, as far as I'm aware. It will just try to make the image fit in the box you send it.
|
||
return aspectRatio; | ||
}, | ||
getImageInfo( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why all the documentation for this function is completely gone? I think it was really useful, as the image logic is getting more and more complex everyday
:punch="punch" | ||
class="absolute" | ||
/> | ||
<div ref="imageElement"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we use better the img
element to pass it to the function?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After testing what I comment on #769 (comment) both in your branch and in master, I see that the Cast & Crew images have a far superior resolution in your branch than in master, which makes me suspect that I was indeed right about this change.
Maybe, being the child absolute positioned, the size can't be determined correctly and it's loading full resolution?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That wasn't working, probably because the image doesn't contain anything and is absolute.
This element has the same size anyway, and is technically our image component.
<v-fade-transition> | ||
<blurhash-canvas | ||
v-if="hash" | ||
:hash="hash" | ||
:width="width" | ||
:height="height" | ||
:punch="punch" | ||
class="absolute" | ||
/> | ||
</v-fade-transition> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need a v-fade transition here. On fast connections the images load so fast that the transition is longer than the time that it takes to load the connection, so we want to show the blurhash as soon as possible without any fancy thing. The image is another thing though.
With your branch, the transition when switching tracks is very "abrupt" if that makes sense.
<div v-if="!$slots.placeholder" class="absolute icon img"> | ||
<v-icon | ||
class="absolute text--disabled" | ||
:size="iconSize" | ||
color="white" | ||
dark | ||
> | ||
<slot v-else name="placeholder"> | ||
<v-icon class="absolute text--disabled" :size="iconSize"> | ||
{{ getItemIcon(item) }} | ||
</v-icon> | ||
</div> | ||
<slot v-else name="placeholder" /> | ||
</slot> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if somewhere we don't want an icon placeholder but something else instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You just use the slot and set whatever you want inside of it.
This is how slots work. What is inside the slot definition is the default. Then you override it by defining a template for that slot when calling the component.
If fixed this locally, but it's important to note a few things:
I am not able to reproduce this using a 10.7.1 server and this branch.
Same thing, I'm not able to reproduce it.
Doing this gives me images all the time:
|
81fa362
to
0612997
Compare
…preference and parents properly
Mixed libraries do not have a CollectionType property, for some reason. As such, they used square cards, which is not correct. This switches the default shape to portrait, which fixes the issue.
0612997
to
f77b8bd
Compare
f77b8bd
to
389b8c8
Compare
Kudos, SonarCloud Quality Gate passed!
|
Rewrites the utility functions to get image URLs, based on Jellyfin-web.
Thumbs with Backdrop fallback
Proper episode images