*

bemtele

  • ***
  • 97 posts
Re: Request for Websites made with Epsilon theme
« Reply #15 on: July 10, 2022, 03:24:19 PM »
If you replace this code in loop-single.php then search and main loads images instantly but as said before without lazyload...
Code: [Select]
       
<?php if(osc_count_item_resources() > 0) { ?>
          <img class="<?php echo (eps_is_lazy() ? 'lazy' ''); ?>" src="<?php echo (eps_is_lazy() ? eps_get_load_image() : osc_resource_thumbnail_url()); ?>" data-src="<?php echo osc_resource_thumbnail_url(); ?>" alt="<?php echo osc_esc_html(osc_item_title()); ?>" />
        <?php } else { ?>
          <img class="<?php echo (eps_is_lazy() ? 'lazy' ''); ?>" src="<?php echo (eps_is_lazy() ? eps_get_load_image() : eps_get_noimage()); ?>" data-src="<?php echo eps_get_noimage(); ?>" alt="<?php echo osc_esc_html(osc_item_title()); ?>" />
        <?php ?>
      </a>


TO
Code: [Select]
        <?php if(osc_count_item_resources() > 0) { ?>
          <img src="<?php echo (osc_resource_thumbnail_url()); ?>" data-src="<?php echo osc_resource_thumbnail_url(); ?>" alt="<?php echo osc_esc_html(osc_item_title()); ?>" />
        <?php } else { ?>
          <img src="<?php echo (eps_get_noimage()); ?>" data-src="<?php echo eps_get_noimage(); ?>" alt="<?php echo osc_esc_html(osc_item_title()); ?>" />
        <?php ?>
      </a>

Thank you very much @mwindey. You have done so much for us.

*

mwindey

  • *****
  • 485 posts
Re: Request for Websites made with Epsilon theme
« Reply #16 on: July 10, 2022, 04:31:45 PM »
@bemtele

That is why forums are for.... Helping each other for free in the best possible way.
We all like to earn a little money back from our investments and time working on our websites  ...  ;)  :-*

*

Vlad7

  • ****
  • 244 posts
Re: Request for Websites made with Epsilon theme
« Reply #17 on: July 11, 2022, 02:55:42 PM »
Plugin currently use this library:
http://jquery.eisbehr.de/lazy/example_basic-usage

You can try to replace it or try browser built-in solution, will be included also in next update.


I have done extensive tests and have realised that the image loading issue on my website has to do with Google Adsense and not the lazyload feature. The issue is that Adsense code is loaded and searched for Ads to display before the website image is loaded even if the image is on the loading point. when you disable AdSense it loads faster. I think the best scenario should be:

1. When the Ad is clicked, the Ad opens with the corresponding image (with or without lazy load) because the ad and its image are the first point of impression for the user.

2. Lady load is applied to defer all the background or below-the-fold images.

3. Adsense is then called for to load Google ads.

The solution is to load the Ads before Adsense. The blog plugin uses this approach: where the blog is loaded together with images before calling the Adsense check site here: https://pampaso.com/blog/article/how-to-buy-cheap-cars-online-b5

So the programmers here should kindly help  8)

I have added a temporary fix. Maybe the expert here can advise or modify it for betterment. In the item.php I have modify the code from:
Code: [Select]
<img class="<?php echo (eps_is_lazy() ? 'lazy' ''); ?>" src="<?php echo (eps_is_lazy() ? eps_get_load_image() : osc_resource_url()); ?>" data-src="<?php echo osc_resource_url(); ?>" alt="<?php echo osc_esc_html(osc_item_title()); ?> - <?php echo $i+1;?>/<?php echo osc_count_item_resources(); ?>"/>
to:

Code: [Select]
<img src="<?php echo osc_resource_url(); ?>" alt="<?php echo osc_esc_html(osc_item_title()); ?> - <?php echo $i+1;?>/<?php echo osc_count_item_resources(); ?>"/>
Now it works to my satisfaction. The product image is shown before the Google Adsense loads. This makes the page usable and relatively faster for the end-user. I welcome modification if anyone has a better way to go about it.

My website: https://pampaso.com

The provided code does not preserve the aspect ratio of the image. In my case, I am getting a stretched image.
 <img src="<?php echo osc_resource_url(); ?>" alt="<?php echo osc_esc_html(osc_item_title()); ?> - <?php echo $i+1;?>/<?php echo osc_count_item_resources(); ?>"/>