Closed GeorgeFive closed 8 months ago
Mmm this is sure a interesting one
What is the movie or tv series where this person is in the cast list? Or did you search for her in person class?
If i view the source of that person page i found this url (right click on the page, choose source and search for her name) https://m.media-amazon.com/images/M/MV5BNWE4OWFjNWItZDc3MC00ZjM1LTg1NTQtZTYwNzY3YzZiNmM1XkEyXkFqcGdeQXVyMTcyMDEyMDA0._V1_QL75_UY207_CR14,0,140,207_.jpg (notice that there is no FMjpg part)
So I'm wondering how you found this cast person image url?
What method did you exactly use is the question, as i may reproduce the problem?
Mmm it is getting more strange I tried this with the series this actress plays in :) anal 4k
This is the image url i get from GraphQL api for this actress: https://m.media-amazon.com/images/M/MV5BNWE4OWFjNWItZDc3MC00ZjM1LTg1NTQtZTYwNzY3YzZiNmM1XkEyXkFqcGdeQXVyMTcyMDEyMDA0._V1_.jpg That works great
But the the image url from cast() output this: https://m.media-amazon.com/images/M/MV5BNWE4OWFjNWItZDc3MC00ZjM1LTg1NTQtZTYwNzY3YzZiNmM1XkEyXkFqcGdeQXVyMTcyMDEyMDA0._V1_QL75_SY44_CR2,0,32,44_.jpg And.. does not work, 404
I tried to remove every parameter, nothing works except the url directly from graphQL. I first thought it is because of the missing @ or @@ but that does not make any difference. apparently this image url does not have @ or @@ in the name.
I think that the problem is that there is no @ or @@ in the image name (they all have one or the other) and therefor the parameters don't work and the image can't be resized or cropped through those parameters. I have never encounter this before. So this is a flaw at GraphQL/imdb
The only thing i can do is build in a header check if the image url with parameters is valid, if not return full image? This will slow down cast, certainly with a lot of cast so i'm not to kind of this check. Or a check if @ or @@ is present, if not return full image, i like this one better. With both checks you will end up with the full image, not a thumbnail.
I was using the cast class for this to get her bio info and photo. I don't use the thumbnails from title, only from person. Using the "medium" option is what triggered this error, but "large" does indeed work as expected.
Not sure what you mean about the @ in the image name? I'm not seeing it in either case, even with a cast member that we know works as expected. Based purely upon the url, I'm not seeing a difference.
This case, medium returned: https://m.media-amazon.com/images/M/MV5BNWE4OWFjNWItZDc3MC00ZjM1LTg1NTQtZTYwNzY3YzZiNmM1XkEyXkFqcGdeQXVyMTcyMDEyMDA0._V1_QL100_SY931_.jpg
Valid, working cast member, medium: https://m.media-amazon.com/images/M/MV5BMzcxNTQ1ODQxMl5BMl5BanBnXkFtZTYwMzI4MDA2._V1_QL100_SY931_.jpg
Large: https://m.media-amazon.com/images/M/MV5BMzcxNTQ1ODQxMl5BMl5BanBnXkFtZTYwMzI4MDA2._V1_.jpg
I just woke up so I may be overlooking something incredibly obvious, haha. But in this case, I don't mind using large if needed, I only use medium to avoid that memory issue we had a while back. I get the image from them and resize it down with gdimage anyway, so large wouldn't be an issue if we use it in certain cases.
Well you are talking about the person class here, medium option is only in there
Those @ are present in all image links (afaik), so it is extremely rare that this image does not have that. But in your example there is no @ in a working url with parameters so without those @ does occur apparently.
So the only option is to check if the url is valid, and return full image if it fails. Is this a good solution?
This solution has a down side that you not really sure you get a thumbnail image, so that might not be best solution?
Ok, I see what you mean with the @ now, I thought you meant in the returned url. Yeah, I think returning full on error would be perfectly fine.
i can use GD to resize the image if the header check fails but that will require that GD is installed
Mm that does not output a url off course so that is not an option either.
I will add the check and update the doc block to inform users
I uploaded the check so in case of small or medium the url header is checked. If it fails the full image url is returned.
This is not a perfect solution as the output is not consistent if you want small of medium image urls. But at least we have a working url, that is certainly better as 404
If you are still resizing the images at your program you better get the full image and resize that one. Small and medium are already resized at imdb (if the urls work of course)
Looks good, thanks! And I only resize down to a max width or height of 500px (staying proportional), as that is all I need. The default 900 for medium is too big, but the 100px small is too small, so I resize to my own needs on my end.
I used to use the full image, but #21 made me change due to niche cases that may pop up.
hah you asked for medium 900 ;) If you want i can change that easily to anything you want?
I learned a lot about imdb and the image parameters so i know for the most part how it works now It took me a while though.. but the images i use are perfect now
Yeah, I just went with 900 for the medium as that's one of the defaults I was using from years ago through a grease monkey script, and I just stuck with it, hah.
But I do store the images on my own server anyway, and also manually add images from other sources, so I just throw everything through the resizer / renamer function I have to make things easy.
Ah okay i understand
Still thinking about this issue, i think i know why this happens
With the image parameters it is possible to generate on the fly the image that is requested but with this is image that is apparently not possible. Only 2 sizes are available, full image or 140x207 (_V1_QL75_UY207CR14,0,140,207.jpg) The last parameter works fine, anything else doesn't work, change 1 number and it doesn't work anymore so this is a fixed available image. https://m.media-amazon.com/images/M/MV5BNWE4OWFjNWItZDc3MC00ZjM1LTg1NTQtZTYwNzY3YzZiNmM1XkEyXkFqcGdeQXVyMTcyMDEyMDA0._V1_QL75_UY207_CR14,0,140,207_.jpg (works fine, it is a cropped and resized image)
So there is no way of knowing what is available, so in this case the full image is the only option
That's certainly possible. I seem to recall someone who had a image with the full size only being something like 100x40, and I believe it worked (it looked like shit, but it did work). Of course, I can't remember who it was so we can check, but I'll keep an eye out.
Closing this as we have a working solution, although not perfect
https://www.imdb.com/name/nm10682391/
This is an interesting one. If you look at her page, she obviously has an image available, and imdbphp returns what appears to be a valid url for the image... but that url is actually a 404. I did some digging, and this is a valid url:
https://m.media-amazon.com/images/M/MV5BNWE4OWFjNWItZDc3MC00ZjM1LTg1NTQtZTYwNzY3YzZiNmM1XkEyXkFqcGdeQXVyMTcyMDEyMDA0._V1_FMjpg_UX451_.jpg
Note the FMjpg part. What makes this even stranger, is that normally you can remove the additional parameters and get a valid image... ie, this should work:
https://m.media-amazon.com/images/M/MV5BNWE4OWFjNWItZDc3MC00ZjM1LTg1NTQtZTYwNzY3YzZiNmM1XkEyXkFqcGdeQXVyMTcyMDEyMDA0.jpg
But it's also a 404 not found.
Any ideas?