@@ -70,7 +70,7 @@ discard block |
||
70 | 70 | . "style='background:$color' " |
71 | 71 | . "/>"; |
72 | 72 | |
73 | - return $header . ImageOptimize::$plugin->optimizedImages->encodeOptimizedSVGDataUri($content); |
|
73 | + return $header.ImageOptimize::$plugin->optimizedImages->encodeOptimizedSVGDataUri($content); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | ); |
92 | 92 | $result = ''; |
93 | 93 | $width = self::PLACEHOLDER_WIDTH; |
94 | - $height = (int)($width / $aspectRatio); |
|
94 | + $height = (int) ($width / $aspectRatio); |
|
95 | 95 | $placeholderPath = $this->createImageFromPath($tempPath, $width, $height, self::PLACEHOLDER_QUALITY, $position); |
96 | 96 | if (!empty($placeholderPath)) { |
97 | 97 | $result = base64_encode(file_get_contents($placeholderPath)); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | { |
114 | 114 | Craft::beginProfile('generateColorPalette', __METHOD__); |
115 | 115 | Craft::info( |
116 | - 'Generating color palette for: ' . $tempPath, |
|
116 | + 'Generating color palette for: '.$tempPath, |
|
117 | 117 | __METHOD__ |
118 | 118 | ); |
119 | 119 | $colorPalette = []; |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * |
142 | 142 | * @return float|int|null |
143 | 143 | */ |
144 | - public function calculateLightness(array $colors): float|int|null |
|
144 | + public function calculateLightness(array $colors): float | int | null |
|
145 | 145 | { |
146 | 146 | $lightness = null; |
147 | 147 | if (!empty($colors)) { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | $lightness /= $colorCount; |
160 | 160 | } |
161 | 161 | |
162 | - return $lightness === null ? $lightness : (int)$lightness; |
|
162 | + return $lightness === null ? $lightness : (int) $lightness; |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -225,7 +225,7 @@ discard block |
||
225 | 225 | __METHOD__ |
226 | 226 | ); |
227 | 227 | $width = self::TEMP_PLACEHOLDER_WIDTH; |
228 | - $height = (int)($width / $aspectRatio); |
|
228 | + $height = (int) ($width / $aspectRatio); |
|
229 | 229 | $tempPath = $this->createImageFromAsset($asset, $width, $height, self::TEMP_PLACEHOLDER_QUALITY, $position); |
230 | 230 | Craft::endProfile('createTempPlaceholderImage', __METHOD__); |
231 | 231 | |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | } |
281 | 281 | } catch (Throwable $e) { |
282 | 282 | Craft::error( |
283 | - 'Error creating temporary image: ' . $e->getMessage(), |
|
283 | + 'Error creating temporary image: '.$e->getMessage(), |
|
284 | 284 | __METHOD__ |
285 | 285 | ); |
286 | 286 | |
@@ -304,14 +304,14 @@ discard block |
||
304 | 304 | |
305 | 305 | |
306 | 306 | // Save the image out to a temp file, then return its contents |
307 | - $tempFilename = uniqid(pathinfo($pathParts['filename'], PATHINFO_FILENAME), true) . '.' . 'jpg'; |
|
308 | - $tempPath = Craft::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $tempFilename; |
|
307 | + $tempFilename = uniqid(pathinfo($pathParts['filename'], PATHINFO_FILENAME), true).'.'.'jpg'; |
|
308 | + $tempPath = Craft::$app->getPath()->getTempPath().DIRECTORY_SEPARATOR.$tempFilename; |
|
309 | 309 | clearstatcache(true, $tempPath); |
310 | 310 | try { |
311 | 311 | $image->saveAs($tempPath); |
312 | 312 | } catch (Throwable $e) { |
313 | 313 | Craft::error( |
314 | - 'Error saving temporary image: ' . $e->getMessage(), |
|
314 | + 'Error saving temporary image: '.$e->getMessage(), |
|
315 | 315 | __METHOD__ |
316 | 316 | ); |
317 | 317 | } |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | } |
114 | 114 | $variant['format'] = $variantFormat; |
115 | 115 | // Only try the transform if it's possible |
116 | - if ((int)$asset->height > 0 |
|
116 | + if ((int) $asset->height > 0 |
|
117 | 117 | && Image::canManipulateAsImage($finalFormat) |
118 | 118 | && Image::canManipulateAsImage($asset->getExtension()) |
119 | 119 | ) { |
@@ -133,10 +133,10 @@ discard block |
||
133 | 133 | } catch (Throwable $exception) { |
134 | 134 | } |
135 | 135 | } catch (Throwable $e) { |
136 | - $msg = 'Failed to update transform: ' . $e->getMessage(); |
|
136 | + $msg = 'Failed to update transform: '.$e->getMessage(); |
|
137 | 137 | Craft::error($msg, __METHOD__); |
138 | 138 | if (Craft::$app instanceof ConsoleApplication) { |
139 | - echo $msg . PHP_EOL; |
|
139 | + echo $msg.PHP_EOL; |
|
140 | 140 | } |
141 | 141 | // Add the error message to the stickyErrors for the model |
142 | 142 | $model->stickyErrors[] = $msg; |
@@ -150,16 +150,16 @@ discard block |
||
150 | 150 | } |
151 | 151 | } else { |
152 | 152 | $canManipulate = Image::canManipulateAsImage($asset->getExtension()); |
153 | - $msg = 'Could not create transform for: ' . $asset->title |
|
154 | - . ' - Final format: ' . $finalFormat |
|
155 | - . ' - Element extension: ' . $asset->getExtension() |
|
156 | - . ' - canManipulateAsImage: ' . $canManipulate; |
|
153 | + $msg = 'Could not create transform for: '.$asset->title |
|
154 | + . ' - Final format: '.$finalFormat |
|
155 | + . ' - Element extension: '.$asset->getExtension() |
|
156 | + . ' - canManipulateAsImage: '.$canManipulate; |
|
157 | 157 | Craft::error( |
158 | 158 | $msg, |
159 | 159 | __METHOD__ |
160 | 160 | ); |
161 | 161 | if (Craft::$app instanceof ConsoleApplication) { |
162 | - echo $msg . PHP_EOL; |
|
162 | + echo $msg.PHP_EOL; |
|
163 | 163 | } |
164 | 164 | if ($canManipulate) { |
165 | 165 | // Add the error message to the stickyErrors for the model |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | // If no image variants were created, populate it with the image itself |
173 | 173 | if (empty($model->optimizedImageUrls)) { |
174 | 174 | $finalFormat = $asset->getExtension(); |
175 | - if ((int)$asset->height > 0 |
|
175 | + if ((int) $asset->height > 0 |
|
176 | 176 | && Image::canManipulateAsImage($finalFormat) |
177 | 177 | ) { |
178 | 178 | $variant = [ |
@@ -188,10 +188,10 @@ discard block |
||
188 | 188 | $this->addVariantImageToModel($asset, $model, $transform, $variant, $aspectRatio); |
189 | 189 | } else { |
190 | 190 | $canManipulate = Image::canManipulateAsImage($asset->getExtension()); |
191 | - $msg = 'Could not create transform for: ' . $asset->title |
|
192 | - . ' - Final format: ' . $finalFormat |
|
193 | - . ' - Element extension: ' . $asset->getExtension() |
|
194 | - . ' - canManipulateAsImage: ' . $canManipulate; |
|
191 | + $msg = 'Could not create transform for: '.$asset->title |
|
192 | + . ' - Final format: '.$finalFormat |
|
193 | + . ' - Element extension: '.$asset->getExtension() |
|
194 | + . ' - canManipulateAsImage: '.$canManipulate; |
|
195 | 195 | Craft::error( |
196 | 196 | $msg, |
197 | 197 | __METHOD__ |
@@ -230,7 +230,7 @@ discard block |
||
230 | 230 | $folder = $asset->getFolder(); |
231 | 231 | while ($folder !== null && !$createVariants) { |
232 | 232 | if ($folder->uid === $subfolder || $folder->name === $subfolder) { |
233 | - Craft::info('Matched subfolder uid: ' . print_r($subfolder, true), __METHOD__); |
|
233 | + Craft::info('Matched subfolder uid: '.print_r($subfolder, true), __METHOD__); |
|
234 | 234 | $createVariants = true; |
235 | 235 | } else { |
236 | 236 | $folder = $folder->getParent(); |
@@ -348,7 +348,7 @@ discard block |
||
348 | 348 | } catch (SiteNotFoundException $e) { |
349 | 349 | $siteId = 0; |
350 | 350 | Craft::error( |
351 | - 'Failed to get primary site: ' . $e->getMessage(), |
|
351 | + 'Failed to get primary site: '.$e->getMessage(), |
|
352 | 352 | __METHOD__ |
353 | 353 | ); |
354 | 354 | } |
@@ -452,7 +452,7 @@ discard block |
||
452 | 452 | { |
453 | 453 | Craft::beginProfile('generatePlaceholders', __METHOD__); |
454 | 454 | Craft::info( |
455 | - 'generatePlaceholders for: ' . print_r($model, true), |
|
455 | + 'generatePlaceholders for: '.print_r($model, true), |
|
456 | 456 | __METHOD__ |
457 | 457 | ); |
458 | 458 | /** @var Settings $settings */ |
@@ -512,20 +512,20 @@ discard block |
||
512 | 512 | } |
513 | 513 | $useAspectRatio = $variant['useAspectRatio'] ?? false; |
514 | 514 | if ($useAspectRatio) { |
515 | - $aspectRatio = (float)$variant['aspectRatioX'] / (float)$variant['aspectRatioY']; |
|
515 | + $aspectRatio = (float) $variant['aspectRatioX'] / (float) $variant['aspectRatioY']; |
|
516 | 516 | } else { |
517 | - $aspectRatio = (float)$asset->width / (float)$asset->height; |
|
517 | + $aspectRatio = (float) $asset->width / (float) $asset->height; |
|
518 | 518 | } |
519 | - $width = (int)$variant['width'] * (int)$retinaSize; |
|
519 | + $width = (int) $variant['width'] * (int) $retinaSize; |
|
520 | 520 | $transform->width = $width; |
521 | - $transform->height = (int)($width / $aspectRatio); |
|
521 | + $transform->height = (int) ($width / $aspectRatio); |
|
522 | 522 | // Image quality |
523 | - $quality = (int)($variant['quality'] ?? null); |
|
523 | + $quality = (int) ($variant['quality'] ?? null); |
|
524 | 524 | if (empty($quality)) { |
525 | 525 | $quality = null; |
526 | 526 | } |
527 | 527 | if ($quality !== null && $settings->lowerQualityRetinaImageVariants && $retinaSize != '1') { |
528 | - $quality = (int)($quality * (1.5 / (int)$retinaSize)); |
|
528 | + $quality = (int) ($quality * (1.5 / (int) $retinaSize)); |
|
529 | 529 | } |
530 | 530 | $transform->quality = $quality; |
531 | 531 | // Interlaced (progressive JPEGs or interlaced PNGs) |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | $transform |
553 | 553 | ); |
554 | 554 | Craft::info( |
555 | - 'URL created: ' . print_r($url, true), |
|
555 | + 'URL created: '.print_r($url, true), |
|
556 | 556 | __METHOD__ |
557 | 557 | ); |
558 | 558 | // Update the model |
@@ -580,7 +580,7 @@ discard block |
||
580 | 580 | $this->generatePlaceholders($asset, $model, $aspectRatio); |
581 | 581 | } |
582 | 582 | Craft::info( |
583 | - 'Created transforms for variant: ' . print_r($variant, true), |
|
583 | + 'Created transforms for variant: '.print_r($variant, true), |
|
584 | 584 | __METHOD__ |
585 | 585 | ); |
586 | 586 | } |
@@ -139,7 +139,7 @@ |
||
139 | 139 | /** |
140 | 140 | * @inheritdoc |
141 | 141 | */ |
142 | - public function getSettingsResponse(): TemplateResponseBehavior|Response |
|
142 | + public function getSettingsResponse(): TemplateResponseBehavior | Response |
|
143 | 143 | { |
144 | 144 | $view = Craft::$app->getView(); |
145 | 145 | $namespace = $view->getNamespace(); |
@@ -61,7 +61,7 @@ |
||
61 | 61 | array $params = [], |
62 | 62 | string $minifier = null, |
63 | 63 | ): string { |
64 | - $template = 'image-optimize/' . $templatePath; |
|
64 | + $template = 'image-optimize/'.$templatePath; |
|
65 | 65 | $oldMode = Craft::$app->view->getTemplateMode(); |
66 | 66 | // Look for the template on the frontend first |
67 | 67 | try { |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | // so we can't extract it from the passed in $config |
42 | 42 | $majorVersion = '5'; |
43 | 43 | // Dev server container name & port are based on the major version of this plugin |
44 | - $devPort = 3000 + (int)$majorVersion; |
|
45 | - $versionName = 'v' . $majorVersion; |
|
44 | + $devPort = 3000 + (int) $majorVersion; |
|
45 | + $versionName = 'v'.$majorVersion; |
|
46 | 46 | return [ |
47 | 47 | 'components' => [ |
48 | 48 | 'optimize' => OptimizeService::class, |
@@ -53,8 +53,8 @@ discard block |
||
53 | 53 | 'assetClass' => ImageOptimizeAsset::class, |
54 | 54 | 'checkDevServer' => true, |
55 | 55 | 'class' => VitePluginService::class, |
56 | - 'devServerInternal' => 'http://craft-imageoptimize-' . $versionName . '-buildchain-dev:' . $devPort, |
|
57 | - 'devServerPublic' => 'http://localhost:' . $devPort, |
|
56 | + 'devServerInternal' => 'http://craft-imageoptimize-'.$versionName.'-buildchain-dev:'.$devPort, |
|
57 | + 'devServerPublic' => 'http://localhost:'.$devPort, |
|
58 | 58 | 'errorEntry' => 'src/js/ImageOptimize.js', |
59 | 59 | 'useDevServer' => true, |
60 | 60 | ], |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | /** |
148 | 148 | * @inheritdoc |
149 | 149 | */ |
150 | - public static function dbType(): array|string|null |
|
150 | + public static function dbType(): array | string | null |
|
151 | 151 | { |
152 | 152 | return Schema::TYPE_TEXT; |
153 | 153 | } |
@@ -212,7 +212,7 @@ discard block |
||
212 | 212 | * @inheritdoc |
213 | 213 | * @since 1.6.2 |
214 | 214 | */ |
215 | - public function getContentGqlType(): Type|array |
|
215 | + public function getContentGqlType(): Type | array |
|
216 | 216 | { |
217 | 217 | $typeArray = OptimizedImagesGenerator::generateTypes($this); |
218 | 218 | |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | /** |
294 | 294 | * @inheritdoc |
295 | 295 | */ |
296 | - public function getSettingsHtml(): null|string |
|
296 | + public function getSettingsHtml(): null | string |
|
297 | 297 | { |
298 | 298 | $namespace = Craft::$app->getView()->getNamespace(); |
299 | 299 | if (str_contains($namespace, Matrix::class)) { |
@@ -329,14 +329,14 @@ discard block |
||
329 | 329 | $sizesWrapperId = Craft::$app->getView()->namespaceInputId('sizes-wrapper'); |
330 | 330 | $view = Craft::$app->getView(); |
331 | 331 | $view->registerJs( |
332 | - 'document.addEventListener("vite-script-loaded", function (e) {' . |
|
333 | - 'if (e.detail.path === "../src/web/assets/src/js/OptimizedImagesField.js") {' . |
|
334 | - 'new Craft.OptimizedImagesInput(' . |
|
335 | - '"' . $namespacedId . '", ' . |
|
336 | - '"' . $namespacePrefix . '",' . |
|
337 | - '"' . $sizesWrapperId . '"' . |
|
338 | - ');' . |
|
339 | - '}' . |
|
332 | + 'document.addEventListener("vite-script-loaded", function (e) {'. |
|
333 | + 'if (e.detail.path === "../src/web/assets/src/js/OptimizedImagesField.js") {'. |
|
334 | + 'new Craft.OptimizedImagesInput('. |
|
335 | + '"'.$namespacedId.'", '. |
|
336 | + '"'.$namespacePrefix.'",'. |
|
337 | + '"'.$sizesWrapperId.'"'. |
|
338 | + ');'. |
|
339 | + '}'. |
|
340 | 340 | '});' |
341 | 341 | ); |
342 | 342 | |
@@ -405,12 +405,12 @@ discard block |
||
405 | 405 | $jsonVars = Json::encode($jsonVars); |
406 | 406 | $view = Craft::$app->getView(); |
407 | 407 | $view->registerJs( |
408 | - 'document.addEventListener("vite-script-loaded", function (e) {' . |
|
409 | - 'if (e.detail.path === "../src/web/assets/src/js/OptimizedImagesField.js") {' . |
|
410 | - "$('#{$nameSpaceId}-field').ImageOptimizeOptimizedImages(" . |
|
411 | - $jsonVars . |
|
412 | - ");" . |
|
413 | - '}' . |
|
408 | + 'document.addEventListener("vite-script-loaded", function (e) {'. |
|
409 | + 'if (e.detail.path === "../src/web/assets/src/js/OptimizedImagesField.js") {'. |
|
410 | + "$('#{$nameSpaceId}-field').ImageOptimizeOptimizedImages(". |
|
411 | + $jsonVars. |
|
412 | + ");". |
|
413 | + '}'. |
|
414 | 414 | '});' |
415 | 415 | ); |
416 | 416 |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | return $this->defaultPlaceholderImage(); |
425 | 425 | } |
426 | 426 | |
427 | - return Template::raw($header . rawurlencode($content)); |
|
427 | + return Template::raw($header.rawurlencode($content)); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | /** |
@@ -502,7 +502,7 @@ discard block |
||
502 | 502 | return $this->defaultPlaceholderImage(); |
503 | 503 | } |
504 | 504 | |
505 | - return Template::raw($header . $content); |
|
505 | + return Template::raw($header.$content); |
|
506 | 506 | } |
507 | 507 | |
508 | 508 | /** |
@@ -590,16 +590,16 @@ discard block |
||
590 | 590 | foreach ($array as $key => $value) { |
591 | 591 | if ($dpr) { |
592 | 592 | $descriptor = '1x'; |
593 | - if (!empty($array[(int)$key / 2])) { |
|
593 | + if (!empty($array[(int) $key / 2])) { |
|
594 | 594 | $descriptor = '2x'; |
595 | 595 | } |
596 | - if (!empty($array[(int)$key / 3])) { |
|
596 | + if (!empty($array[(int) $key / 3])) { |
|
597 | 597 | $descriptor = '3x'; |
598 | 598 | } |
599 | 599 | } else { |
600 | - $descriptor = $key . 'w'; |
|
600 | + $descriptor = $key.'w'; |
|
601 | 601 | } |
602 | - $srcset .= $value . ' ' . $descriptor . ', '; |
|
602 | + $srcset .= $value.' '.$descriptor.', '; |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | return rtrim($srcset, ', '); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | /** |
65 | 65 | * @inheritdoc |
66 | 66 | */ |
67 | - public function getTransformUrl(Asset $asset, CraftImageTransformModel|string|array|null $transform): ?string |
|
67 | + public function getTransformUrl(Asset $asset, CraftImageTransformModel | string | array | null $transform): ?string |
|
68 | 68 | { |
69 | 69 | return null; |
70 | 70 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * @inheritdoc |
74 | 74 | */ |
75 | - public function getWebPUrl(string $url, Asset $asset, CraftImageTransformModel|string|array|null $transform): ?string |
|
75 | + public function getWebPUrl(string $url, Asset $asset, CraftImageTransformModel | string | array | null $transform): ?string |
|
76 | 76 | { |
77 | 77 | return $url; |
78 | 78 | } |
@@ -99,14 +99,14 @@ discard block |
||
99 | 99 | public function getAssetUri(Asset $asset): ?string |
100 | 100 | { |
101 | 101 | $volume = $asset->getVolume(); |
102 | - $assetPath = $volume->getSubpath() . $asset->getPath(); |
|
102 | + $assetPath = $volume->getSubpath().$asset->getPath(); |
|
103 | 103 | |
104 | 104 | // Account for volume types with a subfolder setting |
105 | 105 | // e.g. craftcms/aws-s3, craftcms/google-cloud |
106 | 106 | if ($volume->getFs()->subfolder ?? null) { |
107 | 107 | $subfolder = $volume->getFs()->subfolder; |
108 | 108 | $subfolder = Craft::parseEnv($subfolder); |
109 | - return rtrim($subfolder, '/') . '/' . $assetPath; |
|
109 | + return rtrim($subfolder, '/').'/'.$assetPath; |
|
110 | 110 | } |
111 | 111 | |
112 | 112 | return $assetPath; |
@@ -143,15 +143,15 @@ discard block |
||
143 | 143 | { |
144 | 144 | $path = $this->decomposeUrl($pathOrUrl); |
145 | 145 | $path_parts = pathinfo($path['path']); |
146 | - $new_path = ($path_parts['filename']) . '.' . ($path_parts['extension'] ?? '') . $extension; |
|
146 | + $new_path = ($path_parts['filename']).'.'.($path_parts['extension'] ?? '').$extension; |
|
147 | 147 | if (!empty($path_parts['dirname']) && $path_parts['dirname'] !== '.') { |
148 | 148 | $dirname = $path_parts['dirname']; |
149 | 149 | $dirname = $dirname === '/' ? '' : $dirname; |
150 | - $new_path = $dirname . DIRECTORY_SEPARATOR . $new_path; |
|
150 | + $new_path = $dirname.DIRECTORY_SEPARATOR.$new_path; |
|
151 | 151 | $new_path = preg_replace('/([^:])(\/{2,})/', '$1/', $new_path); |
152 | 152 | } |
153 | 153 | |
154 | - return $path['prefix'] . $new_path . $path['suffix']; |
|
154 | + return $path['prefix'].$new_path.$path['suffix']; |
|
155 | 155 | } |
156 | 156 | |
157 | 157 | // Protected Methods |
@@ -170,14 +170,14 @@ discard block |
||
170 | 170 | |
171 | 171 | if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) { |
172 | 172 | $url_parts = parse_url($pathOrUrl); |
173 | - $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host']; |
|
173 | + $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host']; |
|
174 | 174 | if (!empty($url_parts['port'])) { |
175 | - $result['prefix'] .= ':' . $url_parts['port']; |
|
175 | + $result['prefix'] .= ':'.$url_parts['port']; |
|
176 | 176 | } |
177 | 177 | $result['path'] = $url_parts['path']; |
178 | 178 | $result['suffix'] = ''; |
179 | - $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query']; |
|
180 | - $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment']; |
|
179 | + $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query']; |
|
180 | + $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment']; |
|
181 | 181 | } else { |
182 | 182 | $result['prefix'] = ''; |
183 | 183 | $result['path'] = $pathOrUrl; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | { |
32 | 32 | // Set the class and loading attributes |
33 | 33 | if (isset($attrs['class'])) { |
34 | - $attrs['class'] = trim($attrs['class'] . ' lazyload'); |
|
34 | + $attrs['class'] = trim($attrs['class'].' lazyload'); |
|
35 | 35 | } |
36 | 36 | // Set the style on this element to be the placeholder image as the background-image |
37 | 37 | if (isset($attrs['style']) && !empty($attrs['src'])) { |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | // Don't add the background placeholder if it is set to 'none' |
42 | 42 | if ($placeHolder !== 'none') { |
43 | - $attrs['style']['background-image'] = 'url(' . $this->getLazyLoadSrc($placeHolder) . ')'; |
|
43 | + $attrs['style']['background-image'] = 'url('.$this->getLazyLoadSrc($placeHolder).')'; |
|
44 | 44 | $attrs['style']['background-size'] = 'cover'; |
45 | 45 | } |
46 | 46 | } |