futtta / wp-youtube-lyte

Embed YouTube on WordPress for optimal performance
24 stars 10 forks source link

Add logic in order to be able to use lazy loading for video thumnails #20

Closed softmanro closed 3 years ago

softmanro commented 3 years ago

Add logic in order to be able to use lazy loading (using internal shipped loader or an already existing one from another plugin) for video thumbnails loaded as background images.

Also change the fallback HTTP redirect code in lyteCache.php to temporary instead of permanent.

softmanro commented 3 years ago

Thank you for the review - I think the code looks much better now after the latest changes. Let me know if you need any other updates.

futtta commented 3 years ago

hey @softmanro ; I seem to have completely forgotten about this? :-/ if you're still interested we could pick this up again; could you have a look at the conflicts that arose after my more recent commits ?

softmanro commented 3 years ago

No problem, Frank. I got these sorted, please have a look when you can and let me know if seems right to you. I've gave this a trial run into one of my projects and seems to be work properly.

softmanro commented 3 years ago

Have you got the chance to review this?

futtta commented 3 years ago

i tested your fork, but got PHP errors from lyteCache.php and the images don't show @softmanro ?

[Thu Jun 17 14:58:50.280195 2021] [php7:error] [pid 131686] [client 127.0.0.1:53638] PHP Fatal error: require_once(): Failed opening required '/var/www/html/wordpress/wp-content/plugins/wp-youtube-lyte-softmanro/../../../lyteCache-config.php' (include_path='.:/usr/share/php') in /var/www/html/wordpress/wp-content/plugins/wp-youtube-lyte-softmanro/lyteCache.php on line 18, referer: http://localhost/wordpress/first/2021/06/17/lyte-pr-test/

softmanro commented 3 years ago

i tested your fork, but got PHP errors from lyteCache.php and the images don't show @softmanro ?

[Thu Jun 17 14:58:50.280195 2021] [php7:error] [pid 131686] [client 127.0.0.1:53638] PHP Fatal error: require_once(): Failed opening required '/var/www/html/wordpress/wp-content/plugins/wp-youtube-lyte-softmanro/../../../lyteCache-config.php' (include_path='.:/usr/share/php') in /var/www/html/wordpress/wp-content/plugins/wp-youtube-lyte-softmanro/lyteCache.php on line 18, referer: http://localhost/wordpress/first/2021/06/17/lyte-pr-test/

There was a bad check for the existence of the custom config. On my system the config was there so I did not notice the error, sorry about it. It's fixed with the latest commit.

futtta commented 3 years ago

thanks, I'll retest! Do you have this running somewhere and if so can you share the URL so I can see it on a live site @softmanro ? :)

softmanro commented 3 years ago

Yes, sure - you can see it live on https://icansewthis.com/heart-christmas-ornaments/ or pretty much any other post which includes Youtube links on that site.

futtta commented 3 years ago

great!

another question: what would typically go in lyteCache-config.php ? the contants for LYTE_CACHE_CHILD_DIR and LYTE_CACHE_DIR ? anything else?

softmanro commented 3 years ago

At this point nothing else, unless you would want to include some other named constants used by the plugin.

softmanro commented 3 years ago

Actually right now it only makes sense to define LYTE_CACHE_DIR, since the LYTE_CACHE_CHILD_DIR is used just once in lyteCache.php, solely if LYTE_CACHE_DIR is not already defined.

futtta commented 3 years ago

thanks for the work on this @softmanro , much appreciated! :-)

softmanro commented 3 years ago

My pleasure, Frank.