@@ -58,6 +58,14 @@ public static function textLineCount($text)
5858 return count ($ pcs );
5959 }
6060
61+ public static function configSaveCheck ($ imageConfig )
62+ {
63+ BizException::throwsIfEmpty ('imageConfig 为空 ' , $ imageConfig );
64+ BizException::throwsIfEmpty ('宽度为空 ' , $ imageConfig ['width ' ]);
65+ BizException::throwsIfEmpty ('高度为空 ' , $ imageConfig ['height ' ]);
66+ BizException::throwsIf ('背景图和背景色同时为空 ' , empty ($ imageConfig ['backgroundImage ' ]) && empty ($ imageConfig ['backgroundColor ' ]));
67+ }
68+
6169 public static function render ($ imageConfig , $ variables = [])
6270 {
6371 BizException::throwsIfEmpty ('imageConfig 为空 ' , $ imageConfig );
@@ -163,12 +171,12 @@ public static function render($imageConfig, $variables = [])
163171 case 'image ' :
164172 $ itemImagePath = FileUtil::savePathToLocalTemp ($ item ['data ' ]['image ' ]);
165173 $ itemImage = Image::make ($ itemImagePath );
166- if (!empty ($ item ['data ' ]['opacity ' ]) && $ item ['data ' ]['opacity ' ] < 100 && $ item ['data ' ]['opacity ' ] > 0 ) {
167- $ itemImage ->opacity ($ item ['data ' ]['opacity ' ]);
168- }
169174 if (isset ($ item ['data ' ]['width ' ]) && isset ($ item ['data ' ]['height ' ])) {
170175 $ itemImage ->resize ($ item ['data ' ]['width ' ], $ item ['data ' ]['height ' ]);
171176 }
177+ if (!empty ($ item ['data ' ]['opacity ' ]) && $ item ['data ' ]['opacity ' ] < 100 && $ item ['data ' ]['opacity ' ] > 0 ) {
178+ $ itemImage ->opacity ($ item ['data ' ]['opacity ' ]);
179+ }
172180 $ image ->insert ($ itemImage , 'top-left ' , $ item ['x ' ], $ item ['y ' ]);
173181 break ;
174182 case 'qrcode ' :
0 commit comments