Changeset 2961962
- Timestamp:
- 09/02/2023 01:00:56 PM (3 years ago)
- Location:
- easy-optimizer
- Files:
-
- 12 added
- 2 edited
-
tags/1.0.8 (added)
-
tags/1.0.8/assets (added)
-
tags/1.0.8/assets/lazyload.min.js (added)
-
tags/1.0.8/assets/preload.min.js (added)
-
tags/1.0.8/assets/script.js (added)
-
tags/1.0.8/assets/style.css (added)
-
tags/1.0.8/easy-optimizer.php (added)
-
tags/1.0.8/inc (added)
-
tags/1.0.8/inc/options.php (added)
-
tags/1.0.8/lib (added)
-
tags/1.0.8/lib/simple_html_dom.php (added)
-
tags/1.0.8/readme.txt (added)
-
trunk/easy-optimizer.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
easy-optimizer/trunk/easy-optimizer.php
r2961303 r2961962 4 4 Plugin URI: 5 5 Description: A plugin to preload pages and lazy-load images to improve FCP, LCP (Largest Contentful Paint), and overall performance. 6 Version: 1.0. 76 Version: 1.0.8 7 7 Author: Uzair 8 8 Author URI: https://easywpstuff.com … … 207 207 foreach ( $html->find( 'img' ) as $img ) { 208 208 // Check if the img tag has the class "lazyload" or contains base64 src or is inside the wpadminbar 209 $has_lazyload_class = $img->hasClass('lazyload') || $img->hasClass('rplg-blazy') ;209 $has_lazyload_class = $img->hasClass('lazyload') || $img->hasClass('rplg-blazy') || $img->hasClass('rs-lazyload'); 210 210 $has_base64_src = ( strpos( $img->getAttribute('src'), 'base64' ) !== false ) ||( strpos( $img->getAttribute('src'), 'data:image' ) !== false ); 211 211 $is_inside_wpadminbar = eop_is_inside_wpadminbar( $img ); … … 221 221 // Check if the img tag has srcset 222 222 $has_srcset = $img->hasAttribute( 'srcset' ); 223 $imgwidth = $img->getAttribute( 'width' ); 224 $imgheight = $img->getAttribute( 'height' ); 225 if (empty($imgwidth) && empty($imgheight)) { 226 $src = $img->getAttribute('src'); 227 list($width, $height) = getimagesize($src); 228 if ($width && $height) { 229 $img->setAttribute('width', $width); 230 $img->setAttribute('height', $height); 231 } 232 } 233 if (!empty($width) && !empty($height)) { 234 $placeholder = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 $width $height'%3E%3C/svg%3E"; 235 } elseif (!empty($imgwidth) && !empty($imgheight)) { 236 $placeholder = "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 $imgwidth $imgheight'%3E%3C/svg%3E"; 237 } else { 238 $placeholder = "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"; 239 } 223 240 224 241 // Replace srcset with data-srcset if it exists … … 227 244 $img->removeAttribute( 'srcset' ); 228 245 $img->setAttribute( 'data-src', $img->getAttribute( 'src' ) ); 229 $img->setAttribute( 'src', "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 1'%3E%3C/svg%3E");246 $img->setAttribute( 'src', $placeholder ); 230 247 } else { 231 248 // Add data-src attribute if no srcset exists 232 249 $img->setAttribute( 'data-src', $img->getAttribute( 'src' ) ); 233 $img->setAttribute( 'src', "data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 3 1'%3E%3C/svg%3E");250 $img->setAttribute( 'src', $placeholder); 234 251 } 235 252 $picture = $img->parent(); -
easy-optimizer/trunk/readme.txt
r2961303 r2961962 3 3 Tags: lazyload, elementor, speed, avif, lazy load, core web vitals 4 4 Requires at least: 5.0 5 Tested up to: 6.3 5 Tested up to: 6.3.1 6 6 Requires PHP: 5.6 7 Stable tag: 1.0. 77 Stable tag: 1.0.8 8 8 License: GNU General Public License v2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 22 22 23 23 The plugin has an option to convert images to Avif or webp autmatically via shortpixel cdn when the browser is supported. You need to signup [ShortPixel Here](https://easywpstuff.com/shortpixel) then just associate your domain. That's it! You're all set to enjoy up to 500MB of free usage per month. 24 #### 2. Lazy Load Images 24 25 #### 2. Image elements do not have explicit width and height 26 27 The plugin automatically adds width and height to the images when lazyloading is enabled 28 29 30 #### 3. Lazy Load Images 25 31 26 32 Lazy loading images is a technique that significantly improves your website's loading times. Instead of loading all images at once when a user visits a page, the plugin ensures that images are loaded only when they come into the user's viewport. This results in faster initial page loading and reduces unnecessary data consumption, leading to improved FCP and LCP scores. 27 33 28 #### 2. Lazy Load Iframes and HTML video34 #### 4. Lazy Load Iframes and HTML video 29 35 30 36 The Easy Optimizer plugin extends its lazy loading capabilities to iframes and autoplaying html5 videos. 31 37 32 #### 3. Page Preloading38 #### 5. Page Preloading 33 39 34 40 Preloading pages is another essential feature of Easy Optimizer. By intelligently preloading linked pages in the background while users navigate your site, subsequent page loads become faster and smoother. Preloading reduces the perceived loading time, making your website feel more responsive and enjoyable for visitors.
Note: See TracChangeset
for help on using the changeset viewer.