Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
YouTube has an option to download the maximum resolution thumbnail available ("maxresdefault"). It seems like we should use the highest resolution possible, so that the image styles can resize down to bigger images than is currently possible without much fuzzy image action.
The attached patch accomplishes this.
Comments
Comment #1
JoergPf CreditAttribution: JoergPf commentedGreat, is it possible to reload the thumbs I already have?
Comment #2
joelstein CreditAttribution: joelstein commentedYeah, you'd just delete the folder which has your downloaded YouTube thumbnails, and then the module will download the new version when it tries to load it.
Comment #3
JoergPf CreditAttribution: JoergPf commentedYeah! That's exactly what I was looking for the last three weeks!
I uploaded 40HD-Videos to YouTube and was thinking how to solve the thumb-problem with those low-res thumbs!
Thanks a lot!!!
Comment #4
yadranko CreditAttribution: yadranko commentedAny suggestion on how to get hi-rez thumbnails in Drupal 6 module version?
Comment #5
aaron CreditAttribution: aaron commentedIt would be nice to delete those folders in an update, but I'm not certain how much work that will be. Meanwhile, this looks pretty good to me.
Comment #6
Dave ReidWhat is the maximum size that the maxresdefault image could be? Do we need to worry about it being too large?
Comment #7
Dave Reidhttp://stackoverflow.com/questions/11334710/youtube-thumbnail-link-doesn... indicates that the maxresdefault.jpg is not provided for non-HD videos.
Related:
https://groups.google.com/forum/?fromgroups=#!topic/youtube-api-gdata/L_...
https://groups.google.com/forum/?fromgroups=#!topic/youtube-api-gdata/Qy...
Comment #8
aaron CreditAttribution: aaron commentedThat does seem like a blocker. We would at least need to check for the existence for the larger thumbnail, and if not, then download the smaller. For the potential issue around the image size, perhaps we would need a new setting to control whether to even control the maximum size.
Comment #9
robbt CreditAttribution: robbt commentedThe other thing to consider is that the if there is no highres version the thumbnail file still exists, but it is 120px × 90px box vs. the larger 720px image. So I wonder how complex the code would be to pull the highres thumbnail, check to make sure it's larger than the 1kb 120x90x and if not default to the 320x240 1.jpg. Because it definitely makes sense to use the high res thumbnail if it is available. I just solved this problem independently and then was searching to make the suggestion and found that someone else already figured it out but it hasn't been completely solved yet.
Comment #10
robbt CreditAttribution: robbt commentedI've written the code to do this and it works for me. Here's my first drupal patch. Basically I pulled a tmp file of the high-res thumbnail, if it exists then we pass that, otherwise if the file is empty fall back to the default.
Comment #11
westis CreditAttribution: westis commentedI was also looking for this. Are these patches going to be committed? It's easier to use the dev version than to apply a patch. :)
Comment #12
Devin Carlson CreditAttribution: Devin Carlson commentedMarked #476156: YouTube Widescreen Thumbnail as a duplicate.
Comment #13
marcvangendThanks for the patch, robbt! It looks as if the code would work (didn't test it myself) but I'm going to mark this as "needs work" because the patch does not adhere to the coding standards (indentation, comment length, trailing spaces etc.). For performance, it's better to call
check_plain($parts['v'])
only once and store the return value in a variable.Comment #14
samhassell CreditAttribution: samhassell commentedFix the coding standards stuff and rerolled against rc4.
Comment #15
marcvangendThanks for the re-roll, looks much better :-)
Comment #16
tim_dj#14 works perfect here. Patch is just not easy to apply since it contains a fullpath. Here same patch but without the full path.
Comment #17
travelertt#16 Works with current DEV version (2014-Feb-12) as well. Checked my files directory and the 1920x1080 .jpgs were there.
Comment #19
aaron CreditAttribution: aaron commentedThe patch at #16 no longer applies.
Comment #20
tim_djPlease retest and let's get this thing in before it doesn't apply to DEV again.
Comment #21
tim_djComment #22
esolano CreditAttribution: esolano commentedHi,
How about adding HTTPS (SSL) support for here?
Regards!
Comment #24
tim_djWhy would you want to add https support for downloading images from youtube? besides that is not the current issue! Please review patch #20!
Comment #25
tim_djComment #26
thijsvdanker CreditAttribution: thijsvdanker commentedPatch works as advertised
Comment #27
travelerttI can confirm that the patch media_youtube-highres-thumbnails-1893388-20.patch works correctly as well.
Comment #29
aaron CreditAttribution: aaron commentedCommitted to http://drupalcode.org/project/media_youtube.git/commit/4912276.
Comment #31
travelerttNew version 3.x isn't grabbing the maxresdefault.jpg.
Comment #32
travelerttheshanlk solved this issue again over at https://www.drupal.org/node/2594731. I rerolled his patch.
Comment #33
travelerttComment #34
steinmb CreditAttribution: steinmb as a volunteer commentedTested and applies cleanly. The code look sane too and that always help :) RTBC
Comment #35
Ollie222 CreditAttribution: Ollie222 commentedThe patch in #32 looks to work well for me too.
Thanks guys just what I needed.
Comment #37
joseph.olstadpatch #32 committed to 7.x-3.x dev branch
Comment #38
rozh CreditAttribution: rozh commentedThis is cause regression. Low-res videos have broken thumbnails now.
I get
http://s.ytimg.com/yts/img/image-hh-404-vflvCykRp.png
for every thumbnail.Comment #39
joseph.olstadFollow up in the new issue for low res thumbs
#2886546: low resolution thumbnails