zorchenhimer / MoviePolls

Voting to decide on a movie to watch with MovieNight
https://discord.gg/F2VSgjJ
16 stars 6 forks source link

In certain cases of api autofill the tmdb connector will be unable to find a poster #83

Closed CptPie closed 3 years ago

CptPie commented 3 years ago

This was first encountered when adding Baby Driver (2017) and is caused by the w300 size specification in the request url. In this specific case the poster is not available in this resolution (because of reasons). To fix that we could use the original poster definition although that might increase file size.

Your opinion @zorchenhimer ?

zorchenhimer commented 3 years ago

We could probably DL the larger poster and resize it locally. Save the original then put the resizing in a go routine so it doesn't hang the client.

CptPie commented 3 years ago

I'll change the download part of this issue tomorrow - do you have any idea how to resize the images locally with golang? From what i have seen we would have to use an external library for that (and the one i found was last updated 2018)

CptPie commented 3 years ago

After some more research and testing i think that https://github.com/nfnt/resize might be a good choice.

I ran a local test with an original file size of 75.0kb (1500x2250 px) resized to 10.6kb (300x450 px) using the same code as in the readme of the project.

zorchenhimer commented 3 years ago

Yea, I'm ok with that.

As a note, images should be resized to 300px high, keeping the aspect ratio.