Support » Plugin: WP YouTube Lyte » Use different thumbnail based on player size

  • Resolved Draikin

    (@draikin)


    Right now you can force HQ thumbnails, but downloading the highest quality thumbnail for a player with 640px width is not really efficient, as the image is downsized by the browser anyway. I think that for the default setting, it’d make sense to download different thumbnails based on the selected player size. For example if the player is 640px, then sddefault.jpg would be the preferred size. Thoughts?

    https://wordpress.org/plugins/wp-youtube-lyte/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Frank Goossens

    (@futtta)

    well, that would make sense …

    taking into account LYTE’s size options, there are 3 YT thumbnail sizes that might apply;

    • hqdefault.jpg (480X360)
    • sddefault.jpg (640X480)
    • maxresdefault.jpg (1280X720, but guess this one might actually depend on video quality and will in some cases (older vids) not be available

    the hqdefault.jpg one is used by LYTE by default, when forcing HQ thumbnails maxresdefault.jpg is used.

    so I’ll put this on the “future enhancements”-list, but for now you could use LYTE API’s lyte_match_thumburl-filter to change hqdefault.jpg into sddefault.jpg?

    frank

    Thread Starter Draikin

    (@draikin)

    I’ve taken a look at the filter, that should indeed work, thanks.

    EDIT: for anyone looking to do the same, here’s what you need to add to your functions.php:

    /* Change Youtube Lyte thumbnails to sddefault.jpg */
    add_filter(‘lyte_match_thumburl’,’lyte_my_own_thumburl’,10,1);
    function lyte_my_own_thumburl($thumb) {
    return str_replace(“hqdefault.jpg”, “sddefault.jpg”, $thumb);
    }

    I have to admit though, the maxresdefault looks better than the sddefault.jpg, even with the browser resizing them. The ideal solution would be Youtube Lyte doing its own resizing based on the maxresdefault file, and then caching the result for subsequent requests. I realize that’s a bit more ambitious 🙂

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Use different thumbnail based on player size’ is closed to new replies.