From e1f2aca1372bfb149089bb25d3adaf4fb206c8d7 Mon Sep 17 00:00:00 2001 From: Hai Zheng Date: Tue, 10 Sep 2024 13:28:19 -0400 Subject: [PATCH] v7.0-a7: AVIF in dev --- src/base.cls.php | 1 + src/crawler.cls.php | 2 +- src/img-optm.cls.php | 6 +++++- src/lang.cls.php | 6 +++--- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/base.cls.php b/src/base.cls.php index ec6bde47b..590f151a3 100644 --- a/src/base.cls.php +++ b/src/base.cls.php @@ -602,6 +602,7 @@ class Base extends Root protected static $_multi_switch_list = array( self::O_DEBUG => 2, self::O_OPTM_JS_DEFER => 2, + self::O_IMG_OPTM_WEBP => 2, ); /** diff --git a/src/crawler.cls.php b/src/crawler.cls.php index d0e752b22..35e1be931 100644 --- a/src/crawler.cls.php +++ b/src/crawler.cls.php @@ -1075,7 +1075,7 @@ public function list_crawlers() // WebP on/off if (($this->conf(Base::O_GUEST) && $this->conf(Base::O_GUEST_OPTM)) || $this->conf(Base::O_IMG_OPTM_WEBP)) { - $crawler_factors['webp'] = array(1 => 'WebP', 0 => ''); + $crawler_factors['webp'] = array(1 => 'WebP/AVIF', 0 => ''); } // Guest Mode on/off diff --git a/src/img-optm.cls.php b/src/img-optm.cls.php index 6982d792e..0f67f256c 100644 --- a/src/img-optm.cls.php +++ b/src/img-optm.cls.php @@ -653,10 +653,14 @@ private function _send_request($allowance) 'action' => self::CLOUD_ACTION_NEW_REQ, 'list' => \json_encode($list), 'optm_ori' => $this->conf(self::O_IMG_OPTM_ORI) ? 1 : 0, - 'optm_webp' => $this->conf(self::O_IMG_OPTM_WEBP) ? 1 : 0, 'optm_lossless' => $this->conf(self::O_IMG_OPTM_LOSSLESS) ? 1 : 0, 'keep_exif' => $this->conf(self::O_IMG_OPTM_EXIF) ? 1 : 0, ); + if ($this->conf(self::O_IMG_OPTM_WEBP) == 2) { + $data['optm_avif'] = 1; + } elseif ($this->conf(self::O_IMG_OPTM_WEBP) == 1) { + $data['optm_webp'] = 1; + } // Push to Cloud server $json = Cloud::post(Cloud::SVC_IMG_OPTM, $data); diff --git a/src/lang.cls.php b/src/lang.cls.php index 63ae44f81..e1aa67359 100644 --- a/src/lang.cls.php +++ b/src/lang.cls.php @@ -46,12 +46,12 @@ public static function maybe_translate($raw_string) { $map = array( 'auto_alias_failed_cdn' => - __('Unable to automatically add %1$s as a Domain Alias for main %2$s domain, due to potential CDN conflict.', 'litespeed-cache') . + __('Unable to automatically add %1$s as a Domain Alias for main %2$s domain, due to potential CDN conflict.', 'litespeed-cache') . ' ' . Doc::learn_more('https://quic.cloud/docs/cdn/dns/how-to-setup-domain-alias/', false, false, false, true), 'auto_alias_failed_uid' => - __('Unable to automatically add %1$s as a Domain Alias for main %2$s domain.', 'litespeed-cache') . + __('Unable to automatically add %1$s as a Domain Alias for main %2$s domain.', 'litespeed-cache') . ' ' . __('Alias is in use by another QUIC.cloud account.', 'litespeed-cache') . ' ' . @@ -210,7 +210,7 @@ public static function title($id) self::O_IMG_OPTM_CRON => __('Auto Pull Cron', 'litespeed-cache'), self::O_IMG_OPTM_ORI => __('Optimize Original Images', 'litespeed-cache'), self::O_IMG_OPTM_RM_BKUP => __('Remove Original Backups', 'litespeed-cache'), - self::O_IMG_OPTM_WEBP => __('Image WebP Replacement', 'litespeed-cache'), + self::O_IMG_OPTM_WEBP => __('Next-Gen Image Format', 'litespeed-cache'), self::O_IMG_OPTM_LOSSLESS => __('Optimize Losslessly', 'litespeed-cache'), self::O_IMG_OPTM_EXIF => __('Preserve EXIF/XMP data', 'litespeed-cache'), self::O_IMG_OPTM_WEBP_ATTR => __('WebP Attribute To Replace', 'litespeed-cache'),