@@ -62,7 +62,7 @@ |
||
62 | 62 | string $minifier = null |
63 | 63 | ): string |
64 | 64 | { |
65 | - $template = 'image-optimize/' . $templatePath; |
|
65 | + $template = 'image-optimize/'.$templatePath; |
|
66 | 66 | $oldMode = Craft::$app->view->getTemplateMode(); |
67 | 67 | // Look for the template on the frontend first |
68 | 68 | try { |
@@ -59,7 +59,7 @@ |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | if (!is_file($path)) { |
62 | - Craft::error('Tried to load an image at ' . $path . ', but the file does not exist.', __METHOD__); |
|
62 | + Craft::error('Tried to load an image at '.$path.', but the file does not exist.', __METHOD__); |
|
63 | 63 | throw new ImageException(Craft::t('app', 'No file exists at the given path.')); |
64 | 64 | } |
65 | 65 |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | * @inheritdoc |
188 | 188 | * @since 1.6.2 |
189 | 189 | */ |
190 | - public function getContentGqlType(): Type|array |
|
190 | + public function getContentGqlType(): Type | array |
|
191 | 191 | { |
192 | 192 | $typeArray = OptimizedImagesGenerator::generateTypes($this); |
193 | 193 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | /** |
277 | 277 | * @inheritdoc |
278 | 278 | */ |
279 | - public function getSettingsHtml(): null|string |
|
279 | + public function getSettingsHtml(): null | string |
|
280 | 280 | { |
281 | 281 | $namespace = Craft::$app->getView()->getNamespace(); |
282 | 282 | if (str_contains($namespace, Matrix::class) || str_contains($namespace, SuperTableField::class)) { |
@@ -312,14 +312,14 @@ discard block |
||
312 | 312 | $sizesWrapperId = Craft::$app->getView()->namespaceInputId('sizes-wrapper'); |
313 | 313 | $view = Craft::$app->getView(); |
314 | 314 | $view->registerJs( |
315 | - 'document.addEventListener("vite-script-loaded", function (e) {' . |
|
316 | - 'if (e.detail.path === "../src/web/assets/src/js/OptimizedImagesField.js") {' . |
|
317 | - 'new Craft.OptimizedImagesInput(' . |
|
318 | - '"' . $namespacedId . '", ' . |
|
319 | - '"' . $namespacePrefix . '",' . |
|
320 | - '"' . $sizesWrapperId . '"' . |
|
321 | - ');' . |
|
322 | - '}' . |
|
315 | + 'document.addEventListener("vite-script-loaded", function (e) {'. |
|
316 | + 'if (e.detail.path === "../src/web/assets/src/js/OptimizedImagesField.js") {'. |
|
317 | + 'new Craft.OptimizedImagesInput('. |
|
318 | + '"'.$namespacedId.'", '. |
|
319 | + '"'.$namespacePrefix.'",'. |
|
320 | + '"'.$sizesWrapperId.'"'. |
|
321 | + ');'. |
|
322 | + '}'. |
|
323 | 323 | '});' |
324 | 324 | ); |
325 | 325 | |
@@ -387,12 +387,12 @@ discard block |
||
387 | 387 | $jsonVars = Json::encode($jsonVars); |
388 | 388 | $view = Craft::$app->getView(); |
389 | 389 | $view->registerJs( |
390 | - 'document.addEventListener("vite-script-loaded", function (e) {' . |
|
391 | - 'if (e.detail.path === "../src/web/assets/src/js/OptimizedImagesField.js") {' . |
|
392 | - "$('#{$nameSpaceId}-field').ImageOptimizeOptimizedImages(" . |
|
393 | - $jsonVars . |
|
394 | - ");" . |
|
395 | - '}' . |
|
390 | + 'document.addEventListener("vite-script-loaded", function (e) {'. |
|
391 | + 'if (e.detail.path === "../src/web/assets/src/js/OptimizedImagesField.js") {'. |
|
392 | + "$('#{$nameSpaceId}-field').ImageOptimizeOptimizedImages(". |
|
393 | + $jsonVars. |
|
394 | + ");". |
|
395 | + '}'. |
|
396 | 396 | '});' |
397 | 397 | ); |
398 | 398 |
@@ -41,7 +41,7 @@ |
||
41 | 41 | $model->addError( |
42 | 42 | $attribute, |
43 | 43 | Craft::t('image-optimize', 'Object failed to validate') |
44 | - . '-' . $attributeError . ' - ' . $valueError |
|
44 | + . '-'.$attributeError.' - '.$valueError |
|
45 | 45 | ); |
46 | 46 | } |
47 | 47 | } |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | Craft::configure($query, $this->criteria); |
76 | 76 | } |
77 | 77 | if (Craft::$app instanceof ConsoleApplication) { |
78 | - echo $this->description . PHP_EOL; |
|
78 | + echo $this->description.PHP_EOL; |
|
79 | 79 | } |
80 | 80 | // Use craft\db\Paginator to paginate the results so we don't exceed any memory limits |
81 | 81 | // See batch() and each() discussion here: https://github.com/yiisoft/yii2/issues/8420 |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | while ($currentElement < $totalElements) { |
90 | 90 | $elements = $paginator->getPageResults(); |
91 | 91 | if (Craft::$app instanceof ConsoleApplication) { |
92 | - echo 'Query ' . $paginator->getCurrentPage() . '/' . $paginator->getTotalPages() |
|
93 | - . ' - assets: ' . $paginator->getTotalResults() |
|
92 | + echo 'Query '.$paginator->getCurrentPage().'/'.$paginator->getTotalPages() |
|
93 | + . ' - assets: '.$paginator->getTotalResults() |
|
94 | 94 | . PHP_EOL; |
95 | 95 | } |
96 | 96 | /** @var ElementInterface $element */ |
@@ -103,11 +103,11 @@ discard block |
||
103 | 103 | /** @var $field Field */ |
104 | 104 | foreach ($fields as $field) { |
105 | 105 | if ($field instanceof OptimizedImagesField && $element instanceof Asset) { |
106 | - if ($this->fieldId === null || (int)$field->id === (int)$this->fieldId) { |
|
106 | + if ($this->fieldId === null || (int) $field->id === (int) $this->fieldId) { |
|
107 | 107 | if (Craft::$app instanceof ConsoleApplication) { |
108 | - echo $currentElement . '/' . $totalElements |
|
109 | - . ' - processing asset: ' . $element->title |
|
110 | - . ' from field: ' . $field->name . PHP_EOL; |
|
108 | + echo $currentElement.'/'.$totalElements |
|
109 | + . ' - processing asset: '.$element->title |
|
110 | + . ' from field: '.$field->name.PHP_EOL; |
|
111 | 111 | } |
112 | 112 | try { |
113 | 113 | ImageOptimize::$plugin->optimizedImages->updateOptimizedImageFieldData($field, $element, $this->force); |
@@ -117,9 +117,9 @@ discard block |
||
117 | 117 | echo '[error]: ' |
118 | 118 | . $e->getMessage() |
119 | 119 | . ' while processing ' |
120 | - . $currentElement . '/' . $totalElements |
|
121 | - . ' - processing asset: ' . $element->title |
|
122 | - . ' from field: ' . $field->name . PHP_EOL; |
|
120 | + . $currentElement.'/'.$totalElements |
|
121 | + . ' - processing asset: '.$element->title |
|
122 | + . ' from field: '.$field->name.PHP_EOL; |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | } |
@@ -259,12 +259,12 @@ discard block |
||
259 | 259 | ?: GqlEntityRegistry::createEntity($typeName, new OptimizedImagesType([ |
260 | 260 | 'name' => $typeName, |
261 | 261 | 'description' => 'This entity has all the OptimizedImages properties', |
262 | - 'fields' => function () use ($optimizedImagesFields) { |
|
262 | + 'fields' => function() use ($optimizedImagesFields) { |
|
263 | 263 | return $optimizedImagesFields; |
264 | 264 | }, |
265 | 265 | ])); |
266 | 266 | |
267 | - TypeLoader::registerType($typeName, function () use ($optimizedImagesType) { |
|
267 | + TypeLoader::registerType($typeName, function() use ($optimizedImagesType) { |
|
268 | 268 | return $optimizedImagesType; |
269 | 269 | }); |
270 | 270 | |
@@ -277,6 +277,6 @@ discard block |
||
277 | 277 | public static function getName($context = null): string |
278 | 278 | { |
279 | 279 | /** @var OptimizedImages $context */ |
280 | - return $context->handle . '_OptimizedImages'; |
|
280 | + return $context->handle.'_OptimizedImages'; |
|
281 | 281 | } |
282 | 282 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * |
120 | 120 | * @return ?ImageTransformInterface The Image Transform |
121 | 121 | */ |
122 | - public function createImageTransformType(string|array $config): ?ImageTransformInterface |
|
122 | + public function createImageTransformType(string | array $config): ?ImageTransformInterface |
|
123 | 123 | { |
124 | 124 | if (is_string($config)) { |
125 | 125 | $config = ['type' => $config]; |
@@ -388,7 +388,7 @@ discard block |
||
388 | 388 | . '%'; |
389 | 389 | Craft::info($message, __METHOD__); |
390 | 390 | if (Craft::$app instanceof ConsoleApplication) { |
391 | - echo $message . PHP_EOL; |
|
391 | + echo $message.PHP_EOL; |
|
392 | 392 | } |
393 | 393 | // Create any image variants |
394 | 394 | $this->createImageVariants( |
@@ -426,14 +426,14 @@ discard block |
||
426 | 426 | */ |
427 | 427 | public function saveTransformToTempFile(AssetTransformIndex $index, Image $image): string |
428 | 428 | { |
429 | - $tempFilename = uniqid(pathinfo($index->filename, PATHINFO_FILENAME), true) . '.' . $index->detectedFormat; |
|
430 | - $tempPath = Craft::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $tempFilename; |
|
429 | + $tempFilename = uniqid(pathinfo($index->filename, PATHINFO_FILENAME), true).'.'.$index->detectedFormat; |
|
430 | + $tempPath = Craft::$app->getPath()->getTempPath().DIRECTORY_SEPARATOR.$tempFilename; |
|
431 | 431 | try { |
432 | 432 | $image->saveAs($tempPath); |
433 | 433 | } catch (ImageException $e) { |
434 | - Craft::error('Transformed image save failed: ' . $e->getMessage(), __METHOD__); |
|
434 | + Craft::error('Transformed image save failed: '.$e->getMessage(), __METHOD__); |
|
435 | 435 | } |
436 | - Craft::info('Transformed image saved to: ' . $tempPath, __METHOD__); |
|
436 | + Craft::info('Transformed image saved to: '.$tempPath, __METHOD__); |
|
437 | 437 | |
438 | 438 | return $tempPath; |
439 | 439 | } |
@@ -546,7 +546,7 @@ discard block |
||
546 | 546 | . '%'; |
547 | 547 | Craft::info($message, __METHOD__); |
548 | 548 | if (Craft::$app instanceof ConsoleApplication) { |
549 | - echo $message . PHP_EOL; |
|
549 | + echo $message.PHP_EOL; |
|
550 | 550 | } |
551 | 551 | // Copy the image variant into place |
552 | 552 | $this->copyImageVariantToVolume( |
@@ -644,8 +644,8 @@ discard block |
||
644 | 644 | // Handle auto-sharpening scaled down images |
645 | 645 | if ($imagineImage !== null && $settings->autoSharpenScaledImages) { |
646 | 646 | // See if the image has been scaled >= 50% |
647 | - $widthScale = (int)(($image->getWidth() / $asset->getWidth()) * 100); |
|
648 | - $heightScale = (int)(($image->getHeight() / $asset->getHeight()) * 100); |
|
647 | + $widthScale = (int) (($image->getWidth() / $asset->getWidth()) * 100); |
|
648 | + $heightScale = (int) (($image->getHeight() / $asset->getHeight()) * 100); |
|
649 | 649 | if (($widthScale >= $settings->sharpenScaledImagePercentage) || ($heightScale >= $settings->sharpenScaledImagePercentage)) { |
650 | 650 | $imagineImage->effects() |
651 | 651 | ->sharpen(); |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | . escapeshellarg($tempPath); |
701 | 701 | // Execute the command |
702 | 702 | $shellOutput = $this->executeShellCommand($cmd); |
703 | - Craft::info($cmd . "\n" . $shellOutput, __METHOD__); |
|
703 | + Craft::info($cmd."\n".$shellOutput, __METHOD__); |
|
704 | 704 | } else { |
705 | 705 | Craft::error( |
706 | 706 | $thisProcessor['commandPath'] |
@@ -752,7 +752,7 @@ discard block |
||
752 | 752 | // Make sure the command exists |
753 | 753 | if (is_file($variantCreatorCommand['commandPath'])) { |
754 | 754 | // Get the output file for this image variant |
755 | - $outputPath .= '.' . $variantCreatorCommand['imageVariantExtension']; |
|
755 | + $outputPath .= '.'.$variantCreatorCommand['imageVariantExtension']; |
|
756 | 756 | // Set any options for the command |
757 | 757 | $commandOptions = ''; |
758 | 758 | if (!empty($variantCreatorCommand['commandOptions'])) { |
@@ -787,7 +787,7 @@ discard block |
||
787 | 787 | . escapeshellarg($tempPath); |
788 | 788 | // Execute the command |
789 | 789 | $shellOutput = $this->executeShellCommand($cmd); |
790 | - Craft::info($cmd . "\n" . $shellOutput, __METHOD__); |
|
790 | + Craft::info($cmd."\n".$shellOutput, __METHOD__); |
|
791 | 791 | } else { |
792 | 792 | Craft::error( |
793 | 793 | $variantCreatorCommand['commandPath'] |
@@ -832,17 +832,17 @@ discard block |
||
832 | 832 | } catch (InvalidConfigException $invalidConfigException) { |
833 | 833 | $fs = null; |
834 | 834 | Craft::error( |
835 | - 'Asset file system error: ' . $invalidConfigException->getMessage(), |
|
835 | + 'Asset file system error: '.$invalidConfigException->getMessage(), |
|
836 | 836 | __METHOD__ |
837 | 837 | ); |
838 | 838 | } |
839 | 839 | |
840 | - $variantPath = $uri . '.' . $variantCreatorCommand['imageVariantExtension']; |
|
840 | + $variantPath = $uri.'.'.$variantCreatorCommand['imageVariantExtension']; |
|
841 | 841 | |
842 | 842 | // Delete the variant file in case it is stale |
843 | 843 | $fs->deleteFile($variantPath); |
844 | 844 | Craft::info( |
845 | - 'Deleted variant: ' . $variantPath, |
|
845 | + 'Deleted variant: '.$variantPath, |
|
846 | 846 | __METHOD__ |
847 | 847 | ); |
848 | 848 | } |
@@ -875,17 +875,17 @@ discard block |
||
875 | 875 | } catch (InvalidConfigException $e) { |
876 | 876 | $fs = null; |
877 | 877 | Craft::error( |
878 | - 'Asset volume error: ' . $e->getMessage(), |
|
878 | + 'Asset volume error: '.$e->getMessage(), |
|
879 | 879 | __METHOD__ |
880 | 880 | ); |
881 | 881 | } |
882 | 882 | |
883 | - $variantPath = $uri . '.' . $variantCreatorCommand['imageVariantExtension']; |
|
883 | + $variantPath = $uri.'.'.$variantCreatorCommand['imageVariantExtension']; |
|
884 | 884 | |
885 | 885 | // Delete the variant file in case it is stale |
886 | 886 | $fs->deleteFile($variantPath); |
887 | 887 | Craft::info( |
888 | - 'Variant output path: ' . $outputPath . ' - Variant path: ' . $variantPath, |
|
888 | + 'Variant output path: '.$outputPath.' - Variant path: '.$variantPath, |
|
889 | 889 | __METHOD__ |
890 | 890 | ); |
891 | 891 | clearstatcache(true, $outputPath); |
@@ -913,9 +913,9 @@ discard block |
||
913 | 913 | protected function swapPathExtension(string $path, string $extension): string |
914 | 914 | { |
915 | 915 | $pathParts = pathinfo($path); |
916 | - $newPath = $pathParts['filename'] . '.' . $extension; |
|
916 | + $newPath = $pathParts['filename'].'.'.$extension; |
|
917 | 917 | if (!empty($pathParts['dirname']) && $pathParts['dirname'] !== '.') { |
918 | - $newPath = $pathParts['dirname'] . DIRECTORY_SEPARATOR . $newPath; |
|
918 | + $newPath = $pathParts['dirname'].DIRECTORY_SEPARATOR.$newPath; |
|
919 | 919 | $newPath = preg_replace('#/+#', '/', $newPath); |
920 | 920 | } |
921 | 921 |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | . "style='background:$color' " |
70 | 70 | . "/>"; |
71 | 71 | |
72 | - return $header . ImageOptimize::$plugin->optimizedImages->encodeOptimizedSVGDataUri($content); |
|
72 | + return $header.ImageOptimize::$plugin->optimizedImages->encodeOptimizedSVGDataUri($content); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | ); |
91 | 91 | $result = ''; |
92 | 92 | $width = self::PLACEHOLDER_WIDTH; |
93 | - $height = (int)($width / $aspectRatio); |
|
93 | + $height = (int) ($width / $aspectRatio); |
|
94 | 94 | $placeholderPath = $this->createImageFromPath($tempPath, $width, $height, self::PLACEHOLDER_QUALITY, $position); |
95 | 95 | if (!empty($placeholderPath)) { |
96 | 96 | $result = base64_encode(file_get_contents($placeholderPath)); |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | { |
113 | 113 | Craft::beginProfile('generateColorPalette', __METHOD__); |
114 | 114 | Craft::info( |
115 | - 'Generating color palette for: ' . $tempPath, |
|
115 | + 'Generating color palette for: '.$tempPath, |
|
116 | 116 | __METHOD__ |
117 | 117 | ); |
118 | 118 | $colorPalette = []; |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * |
141 | 141 | * @return float|int|null |
142 | 142 | */ |
143 | - public function calculateLightness(array $colors): float|int|null |
|
143 | + public function calculateLightness(array $colors): float | int | null |
|
144 | 144 | { |
145 | 145 | $lightness = null; |
146 | 146 | if (!empty($colors)) { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | $lightness /= $colorCount; |
159 | 159 | } |
160 | 160 | |
161 | - return $lightness === null ? $lightness : (int)$lightness; |
|
161 | + return $lightness === null ? $lightness : (int) $lightness; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | __METHOD__ |
224 | 224 | ); |
225 | 225 | $width = self::TEMP_PLACEHOLDER_WIDTH; |
226 | - $height = (int)($width / $aspectRatio); |
|
226 | + $height = (int) ($width / $aspectRatio); |
|
227 | 227 | $tempPath = $this->createImageFromAsset($asset, $width, $height, self::TEMP_PLACEHOLDER_QUALITY, $position); |
228 | 228 | Craft::endProfile('createTempPlaceholderImage', __METHOD__); |
229 | 229 | |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | } |
280 | 280 | } catch (Throwable $e) { |
281 | 281 | Craft::error( |
282 | - 'Error creating temporary image: ' . $e->getMessage(), |
|
282 | + 'Error creating temporary image: '.$e->getMessage(), |
|
283 | 283 | __METHOD__ |
284 | 284 | ); |
285 | 285 | |
@@ -300,14 +300,14 @@ discard block |
||
300 | 300 | } |
301 | 301 | |
302 | 302 | // Save the image out to a temp file, then return its contents |
303 | - $tempFilename = uniqid(pathinfo($pathParts['filename'], PATHINFO_FILENAME), true) . '.' . 'jpg'; |
|
304 | - $tempPath = Craft::$app->getPath()->getTempPath() . DIRECTORY_SEPARATOR . $tempFilename; |
|
303 | + $tempFilename = uniqid(pathinfo($pathParts['filename'], PATHINFO_FILENAME), true).'.'.'jpg'; |
|
304 | + $tempPath = Craft::$app->getPath()->getTempPath().DIRECTORY_SEPARATOR.$tempFilename; |
|
305 | 305 | clearstatcache(true, $tempPath); |
306 | 306 | try { |
307 | 307 | $image->saveAs($tempPath); |
308 | 308 | } catch (Throwable $e) { |
309 | 309 | Craft::error( |
310 | - 'Error saving temporary image: ' . $e->getMessage(), |
|
310 | + 'Error saving temporary image: '.$e->getMessage(), |
|
311 | 311 | __METHOD__ |
312 | 312 | ); |
313 | 313 | } |
@@ -125,10 +125,10 @@ discard block |
||
125 | 125 | } catch (Throwable $exception) { |
126 | 126 | } |
127 | 127 | } catch (Throwable $e) { |
128 | - $msg = 'Failed to update transform: ' . $e->getMessage(); |
|
128 | + $msg = 'Failed to update transform: '.$e->getMessage(); |
|
129 | 129 | Craft::error($msg, __METHOD__); |
130 | 130 | if (Craft::$app instanceof ConsoleApplication) { |
131 | - echo $msg . PHP_EOL; |
|
131 | + echo $msg.PHP_EOL; |
|
132 | 132 | } |
133 | 133 | // Add the error message to the stickyErrors for the model |
134 | 134 | $model->stickyErrors[] = $msg; |
@@ -142,16 +142,16 @@ discard block |
||
142 | 142 | } |
143 | 143 | } else { |
144 | 144 | $canManipulate = Image::canManipulateAsImage($asset->getExtension()); |
145 | - $msg = 'Could not create transform for: ' . $asset->title |
|
146 | - . ' - Final format: ' . $finalFormat |
|
147 | - . ' - Element extension: ' . $asset->getExtension() |
|
148 | - . ' - canManipulateAsImage: ' . $canManipulate; |
|
145 | + $msg = 'Could not create transform for: '.$asset->title |
|
146 | + . ' - Final format: '.$finalFormat |
|
147 | + . ' - Element extension: '.$asset->getExtension() |
|
148 | + . ' - canManipulateAsImage: '.$canManipulate; |
|
149 | 149 | Craft::error( |
150 | 150 | $msg, |
151 | 151 | __METHOD__ |
152 | 152 | ); |
153 | 153 | if (Craft::$app instanceof ConsoleApplication) { |
154 | - echo $msg . PHP_EOL; |
|
154 | + echo $msg.PHP_EOL; |
|
155 | 155 | } |
156 | 156 | if ($canManipulate) { |
157 | 157 | // Add the error message to the stickyErrors for the model |
@@ -181,10 +181,10 @@ discard block |
||
181 | 181 | $this->addVariantImageToModel($asset, $model, $transform, $variant, $aspectRatio); |
182 | 182 | } else { |
183 | 183 | $canManipulate = Image::canManipulateAsImage($asset->getExtension()); |
184 | - $msg = 'Could not create transform for: ' . $asset->title |
|
185 | - . ' - Final format: ' . $finalFormat |
|
186 | - . ' - Element extension: ' . $asset->getExtension() |
|
187 | - . ' - canManipulateAsImage: ' . $canManipulate; |
|
184 | + $msg = 'Could not create transform for: '.$asset->title |
|
185 | + . ' - Final format: '.$finalFormat |
|
186 | + . ' - Element extension: '.$asset->getExtension() |
|
187 | + . ' - canManipulateAsImage: '.$canManipulate; |
|
188 | 188 | Craft::error( |
189 | 189 | $msg, |
190 | 190 | __METHOD__ |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | $folder = $asset->getFolder(); |
224 | 224 | while ($folder !== null && !$createVariants) { |
225 | 225 | if ($folder->uid === $subfolder || $folder->name === $subfolder) { |
226 | - Craft::info('Matched subfolder uid: ' . print_r($subfolder, true), __METHOD__); |
|
226 | + Craft::info('Matched subfolder uid: '.print_r($subfolder, true), __METHOD__); |
|
227 | 227 | $createVariants = true; |
228 | 228 | } else { |
229 | 229 | $folder = $folder->getParent(); |
@@ -341,7 +341,7 @@ discard block |
||
341 | 341 | } catch (SiteNotFoundException $e) { |
342 | 342 | $siteId = 0; |
343 | 343 | Craft::error( |
344 | - 'Failed to get primary site: ' . $e->getMessage(), |
|
344 | + 'Failed to get primary site: '.$e->getMessage(), |
|
345 | 345 | __METHOD__ |
346 | 346 | ); |
347 | 347 | } |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | { |
446 | 446 | Craft::beginProfile('generatePlaceholders', __METHOD__); |
447 | 447 | Craft::info( |
448 | - 'generatePlaceholders for: ' . print_r($model, true), |
|
448 | + 'generatePlaceholders for: '.print_r($model, true), |
|
449 | 449 | __METHOD__ |
450 | 450 | ); |
451 | 451 | $settings = ImageOptimize::$plugin->getSettings(); |
@@ -503,20 +503,20 @@ discard block |
||
503 | 503 | } |
504 | 504 | $useAspectRatio = $variant['useAspectRatio'] ?? false; |
505 | 505 | if ($useAspectRatio) { |
506 | - $aspectRatio = (float)$variant['aspectRatioX'] / (float)$variant['aspectRatioY']; |
|
506 | + $aspectRatio = (float) $variant['aspectRatioX'] / (float) $variant['aspectRatioY']; |
|
507 | 507 | } else { |
508 | - $aspectRatio = (float)$asset->width / (float)$asset->height; |
|
508 | + $aspectRatio = (float) $asset->width / (float) $asset->height; |
|
509 | 509 | } |
510 | - $width = (int)$variant['width'] * (int)$retinaSize; |
|
510 | + $width = (int) $variant['width'] * (int) $retinaSize; |
|
511 | 511 | $transform->width = $width; |
512 | - $transform->height = (int)($width / $aspectRatio); |
|
512 | + $transform->height = (int) ($width / $aspectRatio); |
|
513 | 513 | // Image quality |
514 | - $quality = (int)($variant['quality'] ?? null); |
|
514 | + $quality = (int) ($variant['quality'] ?? null); |
|
515 | 515 | if (empty($quality)) { |
516 | 516 | $quality = null; |
517 | 517 | } |
518 | 518 | if ($quality !== null && $settings->lowerQualityRetinaImageVariants && $retinaSize != '1') { |
519 | - $quality = (int)($quality * (1.5 / (int)$retinaSize)); |
|
519 | + $quality = (int) ($quality * (1.5 / (int) $retinaSize)); |
|
520 | 520 | } |
521 | 521 | $transform->quality = $quality; |
522 | 522 | // Interlaced (progressive JPEGs or interlaced PNGs) |
@@ -543,7 +543,7 @@ discard block |
||
543 | 543 | $transform |
544 | 544 | ); |
545 | 545 | Craft::info( |
546 | - 'URL created: ' . print_r($url, true), |
|
546 | + 'URL created: '.print_r($url, true), |
|
547 | 547 | __METHOD__ |
548 | 548 | ); |
549 | 549 | // Update the model |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | $this->generatePlaceholders($asset, $model, $aspectRatio); |
572 | 572 | } |
573 | 573 | Craft::info( |
574 | - 'Created transforms for variant: ' . print_r($variant, true), |
|
574 | + 'Created transforms for variant: '.print_r($variant, true), |
|
575 | 575 | __METHOD__ |
576 | 576 | ); |
577 | 577 | } |