Problem/Motivation

Some video thumbnails are not found when we used the theme youtube_thumbnail.
Actually, we try to get the remote video image (maxresdefault version).

Example :
https://www.youtube.com/watch?v=OOWAUAWy7rs
http://img.youtube.com/vi/OOWAUAWy7rs/maxresdefault.jpg => 404
http://img.youtube.com/vi/OOWAUAWy7rs/0.jpg => 200

Proposed resolution

I suggest to try to retrieve the 'maxresdefault' version, and the '0' version as fallback.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jeanfei created an issue. See original summary.

jeanfei’s picture

The patch try to get the 'maxresdefault' version, then '0' version, remote image will be displayed as fallback.

jeanfei’s picture

Status: Needs work » Needs review
guschilds’s picture

Hi jeanfei,

Thanks for pointing this out!

There was code from the Drupal 7 port that should retrieve the smaller image if the bigger one wasn't found. When the bigger one isn't found, such as your example, a 404 is returned. When that 404 was returned, an exception was being thrown. Before throwing that exception, it should try again, but look for the smaller image. This second attempt wasn't happening.

That code and functionality was not correctly ported. While your patch added a second attempt in that one spot, it was better to fix the existing code that wasn't working for anywhere the function is called from. I've attached a patch which fixes it that I had success with when testing in all situations.

Please test the patch and if it works for you, I'd like to get it committed soon.

Thanks again,
Gus

  • guschilds committed 5948388 on 8.x-1.x
    Issue #2576953 by jeanfei, guschilds: Some video thumbnails are not...
guschilds’s picture

Status: Needs review » Fixed

I went ahead and committed the patch in #4 so I could create a beta1 release. Please let me know if you continue to experience problems. Thanks again!

jeanfei’s picture

Thanks for the new patch which is better !
I've use it in my project, works fine for me !

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.