Ver código fonte

调整4k分辨率尺寸

lh 1 dia atrás
pai
commit
0240ad173b
1 arquivos alterados com 18 adições e 10 exclusões
  1. 18 10
      app/Consts/BaseConst.php

+ 18 - 10
app/Consts/BaseConst.php

@@ -116,6 +116,12 @@ class BaseConst
      * 图片生成:分辨率档位(2k/3k/4k)与画面比例对应的尺寸映射表
      *
      * 统一入口,所有图片生成入口均应引用本常量,禁止在业务代码中重复维护尺寸表。
+     *
+     * 自定义尺寸约束(4k 档按此校准,长边尽量逼近 4k):
+     * 1. 宽、高均须为 16 的倍数;
+     * 2. 长边与短边比例介于 1:3 ~ 3:1;
+     * 3. 长边必须小于 3840,故 16 倍数中可取的最大长边为 3824;
+     * 4. 总像素数介于 655,360 ~ 8,294,400。
      */
     const IMAGE_RESOLUTION_SIZE_MAP = [
         '2k' => [
@@ -143,16 +149,18 @@ class BaseConst
             '1:2' => ['width' => 1536, 'height' => 3072],
         ],
         '4k' => [
-            '1:1' => ['width' => 4096, 'height' => 4096],
-            '3:4' => ['width' => 3520, 'height' => 4704],
-            '4:3' => ['width' => 4704, 'height' => 3520],
-            '16:9' => ['width' => 5504, 'height' => 3040],
-            '9:16' => ['width' => 3040, 'height' => 5504],
-            '2:3' => ['width' => 3328, 'height' => 4992],
-            '3:2' => ['width' => 4992, 'height' => 3328],
-            '21:9' => ['width' => 6240, 'height' => 2656],
-            '2:1' => ['width' => 3840, 'height' => 1920],
-            '1:2' => ['width' => 1920, 'height' => 3840],
+            // 4k ≈ 829 万像素上限,长边取小于 3840 的最大 16 倍数 3824
+            '1:1' => ['width' => 2880, 'height' => 2880],
+            '3:4' => ['width' => 2480, 'height' => 3328],
+            '4:3' => ['width' => 3328, 'height' => 2480],
+            '16:9' => ['width' => 3824, 'height' => 2144],
+            '9:16' => ['width' => 2144, 'height' => 3824],
+            '2:3' => ['width' => 2336, 'height' => 3536],
+            '3:2' => ['width' => 3536, 'height' => 2336],
+            // 21:9 长边已取 3824;短边取 1648 可保持总像素 ≥ 6MP,计费仍归入 4k 档
+            '21:9' => ['width' => 3824, 'height' => 1648],
+            '2:1' => ['width' => 3824, 'height' => 1920],
+            '1:2' => ['width' => 1920, 'height' => 3824],
         ],
     ];