Changeset 3276044
- Timestamp:
- 04/17/2025 04:06:30 PM (10 months ago)
- Location:
- optimole-wp
- Files:
-
- 22 edited
- 1 copied
-
tags/4.0.1 (copied) (copied from optimole-wp/trunk)
-
tags/4.0.1/CHANGELOG.md (modified) (1 diff)
-
tags/4.0.1/README.md (modified) (2 diffs)
-
tags/4.0.1/inc/app_replacer.php (modified) (2 diffs)
-
tags/4.0.1/inc/dam.php (modified) (4 diffs)
-
tags/4.0.1/inc/lazyload_replacer.php (modified) (1 diff)
-
tags/4.0.1/inc/media_offload.php (modified) (1 diff)
-
tags/4.0.1/inc/tag_replacer.php (modified) (2 diffs)
-
tags/4.0.1/inc/traits/dam_offload_utils.php (modified) (1 diff)
-
tags/4.0.1/inc/traits/normalizer.php (modified) (3 diffs)
-
tags/4.0.1/optimole-wp.php (modified) (2 diffs)
-
tags/4.0.1/readme.txt (modified) (2 diffs)
-
trunk/CHANGELOG.md (modified) (1 diff)
-
trunk/README.md (modified) (2 diffs)
-
trunk/inc/app_replacer.php (modified) (2 diffs)
-
trunk/inc/dam.php (modified) (4 diffs)
-
trunk/inc/lazyload_replacer.php (modified) (1 diff)
-
trunk/inc/media_offload.php (modified) (1 diff)
-
trunk/inc/tag_replacer.php (modified) (2 diffs)
-
trunk/inc/traits/dam_offload_utils.php (modified) (1 diff)
-
trunk/inc/traits/normalizer.php (modified) (3 diffs)
-
trunk/optimole-wp.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
optimole-wp/tags/4.0.1/CHANGELOG.md
r3272237 r3276044 1 ##### [Version 4.0.1](https://github.com/Codeinwp/optimole-wp/compare/v4.0.0...v4.0.1) (2025-04-17) 2 3 Fix extraneous quotation mark in image URL when changing fetchpriority. 4 Fix resize behavior for certain image sizes that were improperly resized. 5 1 6 #### [Version 4.0.0](https://github.com/Codeinwp/optimole-wp/compare/v3.14.1...v4.0.0) (2025-04-14) 2 7 -
optimole-wp/tags/4.0.1/README.md
r3272237 r3276044 3 3 **Tags:** image optimization, convert webp, image optimizer, lazy load, image, optimisation, convert AVIF, resize, free cdn, compress images, optimize images 4 4 **Requires at least:** 5.5 5 **Tested up to:** 6. 75 **Tested up to:** 6.8 6 6 **Requires PHP:** 7.4 7 **Stable tag:** 4.0. 07 **Stable tag:** 4.0.1 8 8 **License:** GPLv3 9 9 **License URI:** https://www.gnu.org/licenses/gpl-3.0.en.html … … 248 248 ## Changelog ## 249 249 250 #### [Version 4.0.0](https://github.com/Codeinwp/optimole-wp/compare/v3.14.1...v4.0.0) (2025-04-14) 251 252 ### New Features 253 254 - Added [client-side detection](https://docs.optimole.com/article/1948-bypass-lazy-load-for-first-images) of above-the-fold images with device-specific lazy loading for improved performance on both desktop and mobile. 255 - Introduced [video](https://docs.optimole.com/article/2254-how-to-use-optimole-video-integration) integration that allows uploading, managing, and displaying videos directly via the Optimole DAM. 256 - Enabled rename and replace functionality for media files within both the WordPress media library and the Optimole Cloud Library. 257 - Simplified compression settings with [presets](https://docs.optimole.com/article/2252-choose-the-best-optimization-preset-for-your-website) for Speed and Quality optimized workflows. 258 - Added a download button in the Optimole Cloud Library for quick image retrieval. 259 - Introduced a WordPress dashboard widget showing visits, optimizations, and latest media activity. 260 - Launched a [referral](https://docs.optimole.com/article/2253-referral-program) program where each referral grants 500 extra visits, up to 5,000. 261 - Added support to host and serve PDFs from the Optimole. 262 - Added support for JPEG XL format 263 264 --- 265 266 ### Enhancements 267 268 - Added direct access to the Optimole Cloud Library from the plugin settings for faster navigation. 269 - Redesigned the plugin dashboard layout to make metrics clearer and easier to read. 270 - Enhanced Optimole badge settings with position options and icon-only display mode. 271 - Added sorting options in the Cloud Library to organize media by upload time or file size. 272 - Refreshed the first plugin screen with improved trust-building elements. 273 - Enhanced image preloading logic to more accurately detect and prioritize visible images. 274 - Displayed clear warnings when free users are approaching their offload limits. 275 - Added slider navigation and persistent folder state to the Cloud Library for a better media browsing experience. 276 - Displayed offload quota usage directly in the plugin dashboard. 277 278 --- 279 280 ### Bug Fixes 281 282 - Fixed pixelated SVGs by ensuring proper format is served. 283 - Prevented redirect issues when rolling back offloaded images in the media library. 284 - Respected custom image dimensions set in Elementor sliders during auto-scaling. 285 - Stopped misidentification of mega menu images as hero images. 286 - Prevented broken links when editing cloud-only images by redirecting to the Optimole Library. 287 - Preserved original image URLs in Gutenberg when lazy load and scaling are disabled. 288 - Fixed issue where product gallery images from the Cloud Library also appeared in product descriptions. 289 - Resolved incorrect quota display for disabled accounts with badge enabled. 290 - Ensured first-time DAM authorization works across all browsers. 291 - Corrected sorting so newest uploads appear at the top of the Cloud Library. 292 - Cleared cache automatically when images are updated on the site. 293 - Made update and delete buttons for watermarks visible when multiple rows exist. 294 - Clarified that excluding an image from optimization also excludes it from lazy loading. 295 - Stopped image distortion when no size attributes are present and scaling is disabled. 296 - Synced folder tree view and search in the Cloud Library for consistent navigation. 250 ##### [Version 4.0.1](https://github.com/Codeinwp/optimole-wp/compare/v4.0.0...v4.0.1) (2025-04-17) 251 252 Fix extraneous quotation mark in image URL when changing fetchpriority. 253 Fix resize behavior for certain image sizes that were improperly resized. 297 254 298 255 -
optimole-wp/tags/4.0.1/inc/app_replacer.php
r3272237 r3276044 222 222 * @return array Size mapping. 223 223 */ 224 p rotectedstatic function size_to_crop() {224 public static function size_to_crop() { 225 225 if ( ! empty( self::$size_to_crop ) ) { 226 226 return self::$size_to_crop; … … 615 615 } else { 616 616 $optimized_args = $this->parse_dimension_from_optimized_url( $src ); 617 if ( $optimized_args[0] !== 'auto' || $optimized_args[1] !== 'auto') {617 if ( $optimized_args[0] !== false || $optimized_args[1] !== false ) { 618 618 return [ 619 619 $optimized_args[0] !== 'auto' ? (int) $optimized_args[0] : false, -
optimole-wp/tags/4.0.1/inc/dam.php
r3272237 r3276044 66 66 add_filter( 'image_downsize', [ $this, 'catch_downsize' ], 10, 3 ); 67 67 add_filter( 'wp_prepare_attachment_for_js', [ $this, 'alter_attachment_for_js' ], 10, 3 ); 68 add_filter( 'wp_image_src_get_dimensions', [ $this, 'alter_img_tag_w_h' ], 10, 4 );69 68 add_filter( 'get_attached_file', [ $this, 'alter_attached_file_response' ], 10, 2 ); 70 69 add_filter( 'wp_calculate_image_srcset', [ $this, 'disable_dam_images_srcset' ], 1, 5 ); … … 205 204 } 206 205 $image_url = wp_get_attachment_url( $attachment_id ); 207 $incoming_size = $this->parse_dimension_from_optimized_url( $image_url ); 208 $width = $incoming_size[0]; 209 $height = $incoming_size[1]; 206 list($width, $height) = $this->parse_dimension_from_optimized_url( $image_url ); 210 207 211 208 // Skip resize in single attachment view on backend. … … 213 210 return [ 214 211 $image_url, 215 $width ,216 $height ,212 $width === 'auto' ? false : $width, 213 $height === 'auto' ? false : $height, 217 214 false, 218 215 ]; … … 659 656 660 657 /** 661 * We have to short-circuit the logic that adds width and height to the img tag.662 * It compares the URL basename, and the `file` param for each image.663 * This happens for any image that gets its size set non-explicitly664 * e.g. an image block with its size set from the sidebar to `thumbnail`).665 *666 * Optimole has a single basename for all image resizes in its URL.667 *668 * @param array|false $dimensions Array with first element being the width669 * and second element being the height, or670 * false if dimensions could not be determined.671 * @param string $image_src The image URL (will be Optimole URL).672 * @param array $image_meta The image metadata.673 * @param int $attachment_id The image attachment ID. Default 0.674 */675 public function alter_img_tag_w_h( $dimensions, $image_src, $image_meta, $attachment_id ) {676 if ( ! $this->is_dam_imported_image( $attachment_id ) ) {677 return $dimensions;678 }679 680 // Get the dimensions from the optimized URL.681 $incoming_size = $this->parse_dimension_from_optimized_url( $image_src );682 $width = $incoming_size[0];683 $height = $incoming_size[1];684 685 $sizes = Optml_App_Replacer::image_sizes();686 687 // If this is an image size. Return its dimensions.688 foreach ( $sizes as $size => $args ) {689 if ( (int) $args['width'] !== (int) $width ) {690 continue;691 }692 693 if ( (int) $args['height'] !== (int) $height ) {694 continue;695 }696 697 return [698 $args['width'],699 $args['height'],700 ];701 }702 703 // Fall-through with the original dimensions.704 return $dimensions;705 }706 707 /**708 658 * Replace the image size params in DAM URLs inside a string. 709 659 * -
optimole-wp/tags/4.0.1/inc/lazyload_replacer.php
r3272237 r3276044 254 254 // Remove fetchpriority high attribute when the image is lazyloaded 255 255 if ( strpos( $new_tag, 'fetchpriority' ) !== false ) { 256 $new_tag = preg_replace( '/\s+fetchpriority=(high|[\'"][^\'"]*high[^\'"]*)(?=[\'"\s>]|$)/i', '', $new_tag ); 256 $new_tag = str_ireplace( 257 [ 258 'fetchpriority=high', 259 'fetchpriority="high"', 260 "fetchpriority='high'", 261 'fetchpriority=\"high\"', 262 "fetchpriority=\'high\'", 263 ], 264 '', 265 $new_tag 266 ); 257 267 } 258 268 -
optimole-wp/tags/4.0.1/inc/media_offload.php
r3272237 r3276044 2442 2442 $size = $this->parse_dimension_from_optimized_url( $url ); 2443 2443 2444 if ( $size[0] === false || $size[1] === false ) { 2445 continue; 2446 } 2444 2447 if ( $size[0] === 'auto' || $size[1] === 'auto' ) { 2445 2448 continue; -
optimole-wp/tags/4.0.1/inc/tag_replacer.php
r3272237 r3276044 59 59 add_filter( 'wp_calculate_image_srcset', [ $this, 'filter_srcset_attr' ], PHP_INT_MAX - 1, 5 ); 60 60 add_filter( 'wp_calculate_image_sizes', [ $this, 'filter_sizes_attr' ], 1, 2 ); 61 add_filter( 'wp_image_src_get_dimensions', [ $this, 'filter_image_src_get_dimensions' ], 99, 4 ); 61 62 if ( $this->settings->get( 'retina_images' ) === 'enabled' ) { 62 63 add_filter( 'wp_get_attachment_image_attributes', [ $this, 'filter_attachment_image_attributes' ], 99, 3 ); 63 64 } 65 } 66 67 /** 68 * We have to short-circuit the logic that adds width and height to the img tag. 69 * It compares the URL basename, and the `file` param for each image. 70 * This happens for any image that gets its size set non-explicitly 71 * e.g. an image block with its size set from the sidebar to `thumbnail`). 72 * 73 * Optimole has a single basename for all image resizes in its URL. 74 * 75 * @param mixed $dimensions The dimensions of the image. 76 * @param mixed $image_src The source of the image. 77 * @param mixed $image_meta The meta of the image. 78 * @param mixed $attachment_id The ID of the attachment. 79 */ 80 public function filter_image_src_get_dimensions( $dimensions, $image_src, $image_meta, $attachment_id ) { 81 82 list($width, $height) = $this->parse_dimension_from_optimized_url( $image_src ); 83 84 if ( false === $width || false === $height ) { 85 return $dimensions; 86 } 87 $sizes = Optml_App_Replacer::image_sizes(); 88 89 // If this is an image size. Return its dimensions. 90 foreach ( $sizes as $size => $args ) { 91 if ( (int) $args['width'] !== (int) $width ) { 92 continue; 93 } 94 95 if ( (int) $args['height'] !== (int) $height ) { 96 continue; 97 } 98 99 return [ 100 $args['width'], 101 $args['height'], 102 ]; 103 } 104 105 // Fall-through with the original dimensions. 106 return $dimensions; 64 107 } 65 108 /** … … 512 555 513 556 $image_meta = wp_get_attachment_metadata( $attachment_id ); 514 $sizes = $this->size_to_dimension( $size, $image_meta ); 557 $sizes = $this->size_to_dimension( $size, $image_meta, $attachment_id ); 558 515 559 $image_url = $this->strip_image_size_from_url( $image_url ); 516 560 -
optimole-wp/tags/4.0.1/inc/traits/dam_offload_utils.php
r3185495 r3276044 92 92 private function parse_dimension_from_optimized_url( $url ) { 93 93 $catch = []; 94 $height = 'auto';95 $width = 'auto';94 $height = false; 95 $width = false; 96 96 preg_match( '/\/w:(.*)\/h:(.*)\/q:/', $url, $catch ); 97 97 if ( isset( $catch[1] ) && isset( $catch[2] ) ) { -
optimole-wp/tags/4.0.1/inc/traits/normalizer.php
r3272237 r3276044 196 196 * @param mixed $size The size of the image. Can be an array of width and height, a predefined size, or 'full'. 197 197 * @param array $image_meta Metadata of the image, including width and height. 198 * @param int $attachment_id The ID of the attachment. 198 199 * 199 200 * @return array The dimensions of the image, including width, height, and optional resize parameters. 200 201 */ 201 public function size_to_dimension( $size, $image_meta ) {202 public function size_to_dimension( $size, $image_meta, $attachment_id = null ) { 202 203 // default size 203 204 $sizes = [ … … 206 207 ]; 207 208 $image_args = Optml_App_Replacer::image_sizes(); 209 $sizes2crop = Optml_App_Replacer::size_to_crop(); 208 210 switch ( $size ) { 209 211 case is_array( $size ): … … 217 219 return self::$dimension_cache[ $cache_key ]; 218 220 } 219 $image_resized = image_resize_dimensions( $sizes['width'], $sizes['height'], $width, $height ); 220 if ( $image_resized ) { 221 $width = $image_resized[6]; 222 $height = $image_resized[7]; 223 } else { 224 $width = $image_meta['width']; 225 $height = $image_meta['height']; 226 } 227 list( $sizes['width'], $sizes['height'] ) = image_constrain_size_for_editor( $width, $height, $size ); 228 221 if ( $attachment_id ) { 222 $intermediate = image_get_intermediate_size( $attachment_id, $size ); 223 if ( $intermediate ) { 224 $sizes['width'] = $intermediate['width']; 225 $sizes['height'] = $intermediate['height']; 226 } 227 } 228 229 list( $sizes['width'], $sizes['height'] ) = image_constrain_size_for_editor( $sizes['width'], $sizes['height'], $size ); 230 $resize = apply_filters( 'optml_default_crop', [] ); 231 if ( isset( $sizes2crop[ $sizes['width'] . $sizes['height'] ] ) ) { 232 $resize = $this->to_optml_crop( $sizes2crop[ $sizes['width'] . $sizes['height'] ] ); 233 } 234 $sizes['resize'] = $resize; 229 235 self::$dimension_cache[ $cache_key ] = $sizes; 230 236 break; -
optimole-wp/tags/4.0.1/optimole-wp.php
r3272237 r3276044 3 3 * Plugin Name: Image optimization service by Optimole 4 4 * Description: Complete handling of your website images. 5 * Version: 4.0. 05 * Version: 4.0.1 6 6 * Author: Optimole 7 7 * Author URI: https://optimole.com … … 90 90 define( 'OPTML_URL', plugin_dir_url( __FILE__ ) ); 91 91 define( 'OPTML_PATH', plugin_dir_path( __FILE__ ) ); 92 define( 'OPTML_VERSION', '4.0. 0' );92 define( 'OPTML_VERSION', '4.0.1' ); 93 93 define( 'OPTML_NAMESPACE', 'optml' ); 94 94 define( 'OPTML_BASEFILE', __FILE__ ); -
optimole-wp/tags/4.0.1/readme.txt
r3274492 r3276044 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 4.0. 07 Stable tag: 4.0.1 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html … … 248 248 == Changelog == 249 249 250 #### [Version 4.0.0](https://github.com/Codeinwp/optimole-wp/compare/v3.14.1...v4.0.0) (2025-04-14) 251 252 ### New Features 253 254 - Added [client-side detection](https://docs.optimole.com/article/1948-bypass-lazy-load-for-first-images) of above-the-fold images with device-specific lazy loading for improved performance on both desktop and mobile. 255 - Introduced [video](https://docs.optimole.com/article/2254-how-to-use-optimole-video-integration) integration that allows uploading, managing, and displaying videos directly via the Optimole DAM. 256 - Enabled rename and replace functionality for media files within both the WordPress media library and the Optimole Cloud Library. 257 - Simplified compression settings with [presets](https://docs.optimole.com/article/2252-choose-the-best-optimization-preset-for-your-website) for Speed and Quality optimized workflows. 258 - Added a download button in the Optimole Cloud Library for quick image retrieval. 259 - Introduced a WordPress dashboard widget showing visits, optimizations, and latest media activity. 260 - Launched a [referral](https://docs.optimole.com/article/2253-referral-program) program where each referral grants 500 extra visits, up to 5,000. 261 - Added support to host and serve PDFs from the Optimole. 262 - Added support for JPEG XL format 263 264 --- 265 266 ### Enhancements 267 268 - Added direct access to the Optimole Cloud Library from the plugin settings for faster navigation. 269 - Redesigned the plugin dashboard layout to make metrics clearer and easier to read. 270 - Enhanced Optimole badge settings with position options and icon-only display mode. 271 - Added sorting options in the Cloud Library to organize media by upload time or file size. 272 - Refreshed the first plugin screen with improved trust-building elements. 273 - Enhanced image preloading logic to more accurately detect and prioritize visible images. 274 - Displayed clear warnings when free users are approaching their offload limits. 275 - Added slider navigation and persistent folder state to the Cloud Library for a better media browsing experience. 276 - Displayed offload quota usage directly in the plugin dashboard. 277 278 --- 279 280 ### Bug Fixes 281 282 - Fixed pixelated SVGs by ensuring proper format is served. 283 - Prevented redirect issues when rolling back offloaded images in the media library. 284 - Respected custom image dimensions set in Elementor sliders during auto-scaling. 285 - Stopped misidentification of mega menu images as hero images. 286 - Prevented broken links when editing cloud-only images by redirecting to the Optimole Library. 287 - Preserved original image URLs in Gutenberg when lazy load and scaling are disabled. 288 - Fixed issue where product gallery images from the Cloud Library also appeared in product descriptions. 289 - Resolved incorrect quota display for disabled accounts with badge enabled. 290 - Ensured first-time DAM authorization works across all browsers. 291 - Corrected sorting so newest uploads appear at the top of the Cloud Library. 292 - Cleared cache automatically when images are updated on the site. 293 - Made update and delete buttons for watermarks visible when multiple rows exist. 294 - Clarified that excluding an image from optimization also excludes it from lazy loading. 295 - Stopped image distortion when no size attributes are present and scaling is disabled. 296 - Synced folder tree view and search in the Cloud Library for consistent navigation. 250 ##### [Version 4.0.1](https://github.com/Codeinwp/optimole-wp/compare/v4.0.0...v4.0.1) (2025-04-17) 251 252 Fix extraneous quotation mark in image URL when changing fetchpriority. 253 Fix resize behavior for certain image sizes that were improperly resized. 297 254 298 255 -
optimole-wp/trunk/CHANGELOG.md
r3272237 r3276044 1 ##### [Version 4.0.1](https://github.com/Codeinwp/optimole-wp/compare/v4.0.0...v4.0.1) (2025-04-17) 2 3 Fix extraneous quotation mark in image URL when changing fetchpriority. 4 Fix resize behavior for certain image sizes that were improperly resized. 5 1 6 #### [Version 4.0.0](https://github.com/Codeinwp/optimole-wp/compare/v3.14.1...v4.0.0) (2025-04-14) 2 7 -
optimole-wp/trunk/README.md
r3272237 r3276044 3 3 **Tags:** image optimization, convert webp, image optimizer, lazy load, image, optimisation, convert AVIF, resize, free cdn, compress images, optimize images 4 4 **Requires at least:** 5.5 5 **Tested up to:** 6. 75 **Tested up to:** 6.8 6 6 **Requires PHP:** 7.4 7 **Stable tag:** 4.0. 07 **Stable tag:** 4.0.1 8 8 **License:** GPLv3 9 9 **License URI:** https://www.gnu.org/licenses/gpl-3.0.en.html … … 248 248 ## Changelog ## 249 249 250 #### [Version 4.0.0](https://github.com/Codeinwp/optimole-wp/compare/v3.14.1...v4.0.0) (2025-04-14) 251 252 ### New Features 253 254 - Added [client-side detection](https://docs.optimole.com/article/1948-bypass-lazy-load-for-first-images) of above-the-fold images with device-specific lazy loading for improved performance on both desktop and mobile. 255 - Introduced [video](https://docs.optimole.com/article/2254-how-to-use-optimole-video-integration) integration that allows uploading, managing, and displaying videos directly via the Optimole DAM. 256 - Enabled rename and replace functionality for media files within both the WordPress media library and the Optimole Cloud Library. 257 - Simplified compression settings with [presets](https://docs.optimole.com/article/2252-choose-the-best-optimization-preset-for-your-website) for Speed and Quality optimized workflows. 258 - Added a download button in the Optimole Cloud Library for quick image retrieval. 259 - Introduced a WordPress dashboard widget showing visits, optimizations, and latest media activity. 260 - Launched a [referral](https://docs.optimole.com/article/2253-referral-program) program where each referral grants 500 extra visits, up to 5,000. 261 - Added support to host and serve PDFs from the Optimole. 262 - Added support for JPEG XL format 263 264 --- 265 266 ### Enhancements 267 268 - Added direct access to the Optimole Cloud Library from the plugin settings for faster navigation. 269 - Redesigned the plugin dashboard layout to make metrics clearer and easier to read. 270 - Enhanced Optimole badge settings with position options and icon-only display mode. 271 - Added sorting options in the Cloud Library to organize media by upload time or file size. 272 - Refreshed the first plugin screen with improved trust-building elements. 273 - Enhanced image preloading logic to more accurately detect and prioritize visible images. 274 - Displayed clear warnings when free users are approaching their offload limits. 275 - Added slider navigation and persistent folder state to the Cloud Library for a better media browsing experience. 276 - Displayed offload quota usage directly in the plugin dashboard. 277 278 --- 279 280 ### Bug Fixes 281 282 - Fixed pixelated SVGs by ensuring proper format is served. 283 - Prevented redirect issues when rolling back offloaded images in the media library. 284 - Respected custom image dimensions set in Elementor sliders during auto-scaling. 285 - Stopped misidentification of mega menu images as hero images. 286 - Prevented broken links when editing cloud-only images by redirecting to the Optimole Library. 287 - Preserved original image URLs in Gutenberg when lazy load and scaling are disabled. 288 - Fixed issue where product gallery images from the Cloud Library also appeared in product descriptions. 289 - Resolved incorrect quota display for disabled accounts with badge enabled. 290 - Ensured first-time DAM authorization works across all browsers. 291 - Corrected sorting so newest uploads appear at the top of the Cloud Library. 292 - Cleared cache automatically when images are updated on the site. 293 - Made update and delete buttons for watermarks visible when multiple rows exist. 294 - Clarified that excluding an image from optimization also excludes it from lazy loading. 295 - Stopped image distortion when no size attributes are present and scaling is disabled. 296 - Synced folder tree view and search in the Cloud Library for consistent navigation. 250 ##### [Version 4.0.1](https://github.com/Codeinwp/optimole-wp/compare/v4.0.0...v4.0.1) (2025-04-17) 251 252 Fix extraneous quotation mark in image URL when changing fetchpriority. 253 Fix resize behavior for certain image sizes that were improperly resized. 297 254 298 255 -
optimole-wp/trunk/inc/app_replacer.php
r3272237 r3276044 222 222 * @return array Size mapping. 223 223 */ 224 p rotectedstatic function size_to_crop() {224 public static function size_to_crop() { 225 225 if ( ! empty( self::$size_to_crop ) ) { 226 226 return self::$size_to_crop; … … 615 615 } else { 616 616 $optimized_args = $this->parse_dimension_from_optimized_url( $src ); 617 if ( $optimized_args[0] !== 'auto' || $optimized_args[1] !== 'auto') {617 if ( $optimized_args[0] !== false || $optimized_args[1] !== false ) { 618 618 return [ 619 619 $optimized_args[0] !== 'auto' ? (int) $optimized_args[0] : false, -
optimole-wp/trunk/inc/dam.php
r3272237 r3276044 66 66 add_filter( 'image_downsize', [ $this, 'catch_downsize' ], 10, 3 ); 67 67 add_filter( 'wp_prepare_attachment_for_js', [ $this, 'alter_attachment_for_js' ], 10, 3 ); 68 add_filter( 'wp_image_src_get_dimensions', [ $this, 'alter_img_tag_w_h' ], 10, 4 );69 68 add_filter( 'get_attached_file', [ $this, 'alter_attached_file_response' ], 10, 2 ); 70 69 add_filter( 'wp_calculate_image_srcset', [ $this, 'disable_dam_images_srcset' ], 1, 5 ); … … 205 204 } 206 205 $image_url = wp_get_attachment_url( $attachment_id ); 207 $incoming_size = $this->parse_dimension_from_optimized_url( $image_url ); 208 $width = $incoming_size[0]; 209 $height = $incoming_size[1]; 206 list($width, $height) = $this->parse_dimension_from_optimized_url( $image_url ); 210 207 211 208 // Skip resize in single attachment view on backend. … … 213 210 return [ 214 211 $image_url, 215 $width ,216 $height ,212 $width === 'auto' ? false : $width, 213 $height === 'auto' ? false : $height, 217 214 false, 218 215 ]; … … 659 656 660 657 /** 661 * We have to short-circuit the logic that adds width and height to the img tag.662 * It compares the URL basename, and the `file` param for each image.663 * This happens for any image that gets its size set non-explicitly664 * e.g. an image block with its size set from the sidebar to `thumbnail`).665 *666 * Optimole has a single basename for all image resizes in its URL.667 *668 * @param array|false $dimensions Array with first element being the width669 * and second element being the height, or670 * false if dimensions could not be determined.671 * @param string $image_src The image URL (will be Optimole URL).672 * @param array $image_meta The image metadata.673 * @param int $attachment_id The image attachment ID. Default 0.674 */675 public function alter_img_tag_w_h( $dimensions, $image_src, $image_meta, $attachment_id ) {676 if ( ! $this->is_dam_imported_image( $attachment_id ) ) {677 return $dimensions;678 }679 680 // Get the dimensions from the optimized URL.681 $incoming_size = $this->parse_dimension_from_optimized_url( $image_src );682 $width = $incoming_size[0];683 $height = $incoming_size[1];684 685 $sizes = Optml_App_Replacer::image_sizes();686 687 // If this is an image size. Return its dimensions.688 foreach ( $sizes as $size => $args ) {689 if ( (int) $args['width'] !== (int) $width ) {690 continue;691 }692 693 if ( (int) $args['height'] !== (int) $height ) {694 continue;695 }696 697 return [698 $args['width'],699 $args['height'],700 ];701 }702 703 // Fall-through with the original dimensions.704 return $dimensions;705 }706 707 /**708 658 * Replace the image size params in DAM URLs inside a string. 709 659 * -
optimole-wp/trunk/inc/lazyload_replacer.php
r3272237 r3276044 254 254 // Remove fetchpriority high attribute when the image is lazyloaded 255 255 if ( strpos( $new_tag, 'fetchpriority' ) !== false ) { 256 $new_tag = preg_replace( '/\s+fetchpriority=(high|[\'"][^\'"]*high[^\'"]*)(?=[\'"\s>]|$)/i', '', $new_tag ); 256 $new_tag = str_ireplace( 257 [ 258 'fetchpriority=high', 259 'fetchpriority="high"', 260 "fetchpriority='high'", 261 'fetchpriority=\"high\"', 262 "fetchpriority=\'high\'", 263 ], 264 '', 265 $new_tag 266 ); 257 267 } 258 268 -
optimole-wp/trunk/inc/media_offload.php
r3272237 r3276044 2442 2442 $size = $this->parse_dimension_from_optimized_url( $url ); 2443 2443 2444 if ( $size[0] === false || $size[1] === false ) { 2445 continue; 2446 } 2444 2447 if ( $size[0] === 'auto' || $size[1] === 'auto' ) { 2445 2448 continue; -
optimole-wp/trunk/inc/tag_replacer.php
r3272237 r3276044 59 59 add_filter( 'wp_calculate_image_srcset', [ $this, 'filter_srcset_attr' ], PHP_INT_MAX - 1, 5 ); 60 60 add_filter( 'wp_calculate_image_sizes', [ $this, 'filter_sizes_attr' ], 1, 2 ); 61 add_filter( 'wp_image_src_get_dimensions', [ $this, 'filter_image_src_get_dimensions' ], 99, 4 ); 61 62 if ( $this->settings->get( 'retina_images' ) === 'enabled' ) { 62 63 add_filter( 'wp_get_attachment_image_attributes', [ $this, 'filter_attachment_image_attributes' ], 99, 3 ); 63 64 } 65 } 66 67 /** 68 * We have to short-circuit the logic that adds width and height to the img tag. 69 * It compares the URL basename, and the `file` param for each image. 70 * This happens for any image that gets its size set non-explicitly 71 * e.g. an image block with its size set from the sidebar to `thumbnail`). 72 * 73 * Optimole has a single basename for all image resizes in its URL. 74 * 75 * @param mixed $dimensions The dimensions of the image. 76 * @param mixed $image_src The source of the image. 77 * @param mixed $image_meta The meta of the image. 78 * @param mixed $attachment_id The ID of the attachment. 79 */ 80 public function filter_image_src_get_dimensions( $dimensions, $image_src, $image_meta, $attachment_id ) { 81 82 list($width, $height) = $this->parse_dimension_from_optimized_url( $image_src ); 83 84 if ( false === $width || false === $height ) { 85 return $dimensions; 86 } 87 $sizes = Optml_App_Replacer::image_sizes(); 88 89 // If this is an image size. Return its dimensions. 90 foreach ( $sizes as $size => $args ) { 91 if ( (int) $args['width'] !== (int) $width ) { 92 continue; 93 } 94 95 if ( (int) $args['height'] !== (int) $height ) { 96 continue; 97 } 98 99 return [ 100 $args['width'], 101 $args['height'], 102 ]; 103 } 104 105 // Fall-through with the original dimensions. 106 return $dimensions; 64 107 } 65 108 /** … … 512 555 513 556 $image_meta = wp_get_attachment_metadata( $attachment_id ); 514 $sizes = $this->size_to_dimension( $size, $image_meta ); 557 $sizes = $this->size_to_dimension( $size, $image_meta, $attachment_id ); 558 515 559 $image_url = $this->strip_image_size_from_url( $image_url ); 516 560 -
optimole-wp/trunk/inc/traits/dam_offload_utils.php
r3185495 r3276044 92 92 private function parse_dimension_from_optimized_url( $url ) { 93 93 $catch = []; 94 $height = 'auto';95 $width = 'auto';94 $height = false; 95 $width = false; 96 96 preg_match( '/\/w:(.*)\/h:(.*)\/q:/', $url, $catch ); 97 97 if ( isset( $catch[1] ) && isset( $catch[2] ) ) { -
optimole-wp/trunk/inc/traits/normalizer.php
r3272237 r3276044 196 196 * @param mixed $size The size of the image. Can be an array of width and height, a predefined size, or 'full'. 197 197 * @param array $image_meta Metadata of the image, including width and height. 198 * @param int $attachment_id The ID of the attachment. 198 199 * 199 200 * @return array The dimensions of the image, including width, height, and optional resize parameters. 200 201 */ 201 public function size_to_dimension( $size, $image_meta ) {202 public function size_to_dimension( $size, $image_meta, $attachment_id = null ) { 202 203 // default size 203 204 $sizes = [ … … 206 207 ]; 207 208 $image_args = Optml_App_Replacer::image_sizes(); 209 $sizes2crop = Optml_App_Replacer::size_to_crop(); 208 210 switch ( $size ) { 209 211 case is_array( $size ): … … 217 219 return self::$dimension_cache[ $cache_key ]; 218 220 } 219 $image_resized = image_resize_dimensions( $sizes['width'], $sizes['height'], $width, $height ); 220 if ( $image_resized ) { 221 $width = $image_resized[6]; 222 $height = $image_resized[7]; 223 } else { 224 $width = $image_meta['width']; 225 $height = $image_meta['height']; 226 } 227 list( $sizes['width'], $sizes['height'] ) = image_constrain_size_for_editor( $width, $height, $size ); 228 221 if ( $attachment_id ) { 222 $intermediate = image_get_intermediate_size( $attachment_id, $size ); 223 if ( $intermediate ) { 224 $sizes['width'] = $intermediate['width']; 225 $sizes['height'] = $intermediate['height']; 226 } 227 } 228 229 list( $sizes['width'], $sizes['height'] ) = image_constrain_size_for_editor( $sizes['width'], $sizes['height'], $size ); 230 $resize = apply_filters( 'optml_default_crop', [] ); 231 if ( isset( $sizes2crop[ $sizes['width'] . $sizes['height'] ] ) ) { 232 $resize = $this->to_optml_crop( $sizes2crop[ $sizes['width'] . $sizes['height'] ] ); 233 } 234 $sizes['resize'] = $resize; 229 235 self::$dimension_cache[ $cache_key ] = $sizes; 230 236 break; -
optimole-wp/trunk/optimole-wp.php
r3272237 r3276044 3 3 * Plugin Name: Image optimization service by Optimole 4 4 * Description: Complete handling of your website images. 5 * Version: 4.0. 05 * Version: 4.0.1 6 6 * Author: Optimole 7 7 * Author URI: https://optimole.com … … 90 90 define( 'OPTML_URL', plugin_dir_url( __FILE__ ) ); 91 91 define( 'OPTML_PATH', plugin_dir_path( __FILE__ ) ); 92 define( 'OPTML_VERSION', '4.0. 0' );92 define( 'OPTML_VERSION', '4.0.1' ); 93 93 define( 'OPTML_NAMESPACE', 'optml' ); 94 94 define( 'OPTML_BASEFILE', __FILE__ ); -
optimole-wp/trunk/readme.txt
r3274492 r3276044 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.4 7 Stable tag: 4.0. 07 Stable tag: 4.0.1 8 8 License: GPLv3 9 9 License URI: https://www.gnu.org/licenses/gpl-3.0.en.html … … 248 248 == Changelog == 249 249 250 #### [Version 4.0.0](https://github.com/Codeinwp/optimole-wp/compare/v3.14.1...v4.0.0) (2025-04-14) 251 252 ### New Features 253 254 - Added [client-side detection](https://docs.optimole.com/article/1948-bypass-lazy-load-for-first-images) of above-the-fold images with device-specific lazy loading for improved performance on both desktop and mobile. 255 - Introduced [video](https://docs.optimole.com/article/2254-how-to-use-optimole-video-integration) integration that allows uploading, managing, and displaying videos directly via the Optimole DAM. 256 - Enabled rename and replace functionality for media files within both the WordPress media library and the Optimole Cloud Library. 257 - Simplified compression settings with [presets](https://docs.optimole.com/article/2252-choose-the-best-optimization-preset-for-your-website) for Speed and Quality optimized workflows. 258 - Added a download button in the Optimole Cloud Library for quick image retrieval. 259 - Introduced a WordPress dashboard widget showing visits, optimizations, and latest media activity. 260 - Launched a [referral](https://docs.optimole.com/article/2253-referral-program) program where each referral grants 500 extra visits, up to 5,000. 261 - Added support to host and serve PDFs from the Optimole. 262 - Added support for JPEG XL format 263 264 --- 265 266 ### Enhancements 267 268 - Added direct access to the Optimole Cloud Library from the plugin settings for faster navigation. 269 - Redesigned the plugin dashboard layout to make metrics clearer and easier to read. 270 - Enhanced Optimole badge settings with position options and icon-only display mode. 271 - Added sorting options in the Cloud Library to organize media by upload time or file size. 272 - Refreshed the first plugin screen with improved trust-building elements. 273 - Enhanced image preloading logic to more accurately detect and prioritize visible images. 274 - Displayed clear warnings when free users are approaching their offload limits. 275 - Added slider navigation and persistent folder state to the Cloud Library for a better media browsing experience. 276 - Displayed offload quota usage directly in the plugin dashboard. 277 278 --- 279 280 ### Bug Fixes 281 282 - Fixed pixelated SVGs by ensuring proper format is served. 283 - Prevented redirect issues when rolling back offloaded images in the media library. 284 - Respected custom image dimensions set in Elementor sliders during auto-scaling. 285 - Stopped misidentification of mega menu images as hero images. 286 - Prevented broken links when editing cloud-only images by redirecting to the Optimole Library. 287 - Preserved original image URLs in Gutenberg when lazy load and scaling are disabled. 288 - Fixed issue where product gallery images from the Cloud Library also appeared in product descriptions. 289 - Resolved incorrect quota display for disabled accounts with badge enabled. 290 - Ensured first-time DAM authorization works across all browsers. 291 - Corrected sorting so newest uploads appear at the top of the Cloud Library. 292 - Cleared cache automatically when images are updated on the site. 293 - Made update and delete buttons for watermarks visible when multiple rows exist. 294 - Clarified that excluding an image from optimization also excludes it from lazy loading. 295 - Stopped image distortion when no size attributes are present and scaling is disabled. 296 - Synced folder tree view and search in the Cloud Library for consistent navigation. 250 ##### [Version 4.0.1](https://github.com/Codeinwp/optimole-wp/compare/v4.0.0...v4.0.1) (2025-04-17) 251 252 Fix extraneous quotation mark in image URL when changing fetchpriority. 253 Fix resize behavior for certain image sizes that were improperly resized. 297 254 298 255
Note: See TracChangeset
for help on using the changeset viewer.