• Resolved silencerocks

    (@silencerocks)


    Hi!

    This plugin does a great job speeding up my site. The only thing is, it uses the Thumbnails from the YouTube-site and that servers are way slower than those of my hoster. So when I put a YouTube-video above the fold, my pagespeed-insights-rating drops quite a lot.

    The solution would be to replace that YouTube-thumbnail-URL with a local one. It is just always the same video I use, so I’d be happy to replace that url manually with a local one.

    Is there a filter in WordPress that would work with that? Or is there a even more elegant solution to this?

    Thank You ??

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor WP Rocket

    (@wp_rocket)

    Hi @silencerocks!

    I’m afraid we have no plans for the moment to host YouTube preview images.

    If you are using one specific video per website, you can do the following:

    • Download the preview image and upload it to the media library.
    • Get the URL.
    • Go the to following file: src/Dependencies/RocketLazyload/Assets.php
    • Replace: https://i.ytimg.com/vi/ID/' . $args['resolution'] . '.jpg with the URL of your preview image.
    • Save the changes.
    • Clear the cache (if you are using any cache plugin).

    If you are using multiple videos per website, you can do the following:

    • Create a new folder where you can put manually videos preview. Let’s name it wp-content/uploads/youtube/
    • Upload preview images using the following naming logic video_id.jpg.
    • Go the to following file: src/Dependencies/RocketLazyload/Assets.php
    • Replace: https://i.ytimg.com/vi/ID/' . $args['resolution'] . '.jpg with https://domain.ext/wp-content/uploads/youtube/ID.jpg. Replace the domain.ext with your own domain name.
    • Save the changes.
    • Clear the cache (if you are using any cache plugin).

    I hope it helps you achieve what you are looking for.

    Best regards,

    Adame D.

    Thread Starter silencerocks

    (@silencerocks)

    Hello Adame,

    great support, thanks a lot!

    Both methods work. What’s a bit disapointing is, that caching the thumbnails locally doesn’t improve loading speed. If I put the video above the fold it becomes the Largest Contentful Paint and takes 3,4 Seconds to load – opposed to 1,5 average on my website.

    I might have been wrong, thinking, it’s just an image – from what I understood now in the sourcecode there’s a javascript that needs to be executed first.

    Anyway I don’t want to stress that topic too much. This plugin remains the best choice and makes my website blazing fast ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Replace YouTube-preview-Thumbnails with local images’ is closed to new replies.