@@ -148,14 +148,14 @@ discard block |
||
148 | 148 | { |
149 | 149 | $path = $this->decomposeUrl($pathOrUrl); |
150 | 150 | $path_parts = pathinfo($path['path']); |
151 | - $new_path = ($path_parts['filename'] ?? '') . '.' . ($path_parts['extension'] ?? '') . $extension; |
|
151 | + $new_path = ($path_parts['filename'] ?? '').'.'.($path_parts['extension'] ?? '').$extension; |
|
152 | 152 | if (!empty($path_parts['dirname']) && $path_parts['dirname'] !== '.') { |
153 | 153 | $dirname = $path_parts['dirname']; |
154 | 154 | $dirname = $dirname === '/' ? '' : $dirname; |
155 | - $new_path = $dirname . DIRECTORY_SEPARATOR . $new_path; |
|
155 | + $new_path = $dirname.DIRECTORY_SEPARATOR.$new_path; |
|
156 | 156 | $new_path = preg_replace('/([^:])(\/{2,})/', '$1/', $new_path); |
157 | 157 | } |
158 | - $output = $path['prefix'] . $new_path . $path['suffix']; |
|
158 | + $output = $path['prefix'].$new_path.$path['suffix']; |
|
159 | 159 | |
160 | 160 | return $output; |
161 | 161 | } |
@@ -176,14 +176,14 @@ discard block |
||
176 | 176 | |
177 | 177 | if (filter_var($pathOrUrl, FILTER_VALIDATE_URL)) { |
178 | 178 | $url_parts = parse_url($pathOrUrl); |
179 | - $result['prefix'] = $url_parts['scheme'] . '://' . $url_parts['host']; |
|
179 | + $result['prefix'] = $url_parts['scheme'].'://'.$url_parts['host']; |
|
180 | 180 | if (!empty($url_parts['port'])) { |
181 | - $result['prefix'] .= ':' . $url_parts['port']; |
|
181 | + $result['prefix'] .= ':'.$url_parts['port']; |
|
182 | 182 | } |
183 | 183 | $result['path'] = $url_parts['path']; |
184 | 184 | $result['suffix'] = ''; |
185 | - $result['suffix'] .= empty($url_parts['query']) ? '' : '?' . $url_parts['query']; |
|
186 | - $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#' . $url_parts['fragment']; |
|
185 | + $result['suffix'] .= empty($url_parts['query']) ? '' : '?'.$url_parts['query']; |
|
186 | + $result['suffix'] .= empty($url_parts['fragment']) ? '' : '#'.$url_parts['fragment']; |
|
187 | 187 | } else { |
188 | 188 | $result['prefix'] = ''; |
189 | 189 | $result['path'] = $pathOrUrl; |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | $folder = $asset->getFolder(); |
171 | 171 | while ($folder !== null && !$createVariants) { |
172 | 172 | if ($folder->uid === $subfolder) { |
173 | - Craft::info('Matched subfolder uid: ' . print_r($subfolder, true), __METHOD__); |
|
173 | + Craft::info('Matched subfolder uid: '.print_r($subfolder, true), __METHOD__); |
|
174 | 174 | $createVariants = true; |
175 | 175 | } else { |
176 | 176 | $folder = $folder->getParent(); |
@@ -437,20 +437,20 @@ discard block |
||
437 | 437 | } |
438 | 438 | $useAspectRatio = $variant['useAspectRatio'] ?? false; |
439 | 439 | if ($useAspectRatio) { |
440 | - $aspectRatio = (int)$variant['aspectRatioX'] / (int)$variant['aspectRatioY']; |
|
440 | + $aspectRatio = (int) $variant['aspectRatioX'] / (int) $variant['aspectRatioY']; |
|
441 | 441 | } else { |
442 | - $aspectRatio = (int)$asset->width / (int)$asset->height; |
|
442 | + $aspectRatio = (int) $asset->width / (int) $asset->height; |
|
443 | 443 | } |
444 | - $width = (int)$variant['width'] * (int)$retinaSize; |
|
444 | + $width = (int) $variant['width'] * (int) $retinaSize; |
|
445 | 445 | $transform->width = $width; |
446 | - $transform->height = (int)($width / $aspectRatio); |
|
446 | + $transform->height = (int) ($width / $aspectRatio); |
|
447 | 447 | // Image quality |
448 | - $quality = (int)($variant['quality'] ?? null); |
|
448 | + $quality = (int) ($variant['quality'] ?? null); |
|
449 | 449 | if (empty($quality)) { |
450 | 450 | $quality = null; |
451 | 451 | } |
452 | 452 | if ($quality !== null && $settings->lowerQualityRetinaImageVariants && $retinaSize != '1') { |
453 | - $quality = (int)($quality * (1.5 / (int)$retinaSize)); |
|
453 | + $quality = (int) ($quality * (1.5 / (int) $retinaSize)); |
|
454 | 454 | } |
455 | 455 | $transform->quality = $quality; |
456 | 456 | // Interlaced (progressive JPEGs or interlaced PNGs) |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | if ($field instanceof OptimizedImagesField && $element instanceof Asset) { |
85 | 85 | if ($this->fieldId === null || $field->id == $this->fieldId) { |
86 | 86 | if (Craft::$app instanceof ConsoleApplication) { |
87 | - echo $currentElement . '/' . $totalElements |
|
88 | - . ' - processing asset: ' . $element->title |
|
89 | - . ' from field: ' . $field->name . PHP_EOL; |
|
87 | + echo $currentElement.'/'.$totalElements |
|
88 | + . ' - processing asset: '.$element->title |
|
89 | + . ' from field: '.$field->name.PHP_EOL; |
|
90 | 90 | } |
91 | 91 | try { |
92 | 92 | ImageOptimize::$plugin->optimizedImages->updateOptimizedImageFieldData($field, $element); |
@@ -96,9 +96,9 @@ discard block |
||
96 | 96 | echo '[error]: ' |
97 | 97 | . $e->getMessage() |
98 | 98 | . ' while processing ' |
99 | - . $currentElement . '/' . $totalElements |
|
100 | - . ' - processing asset: ' . $element->title |
|
101 | - . ' from field: ' . $field->name . PHP_EOL; |
|
99 | + . $currentElement.'/'.$totalElements |
|
100 | + . ' - processing asset: '.$element->title |
|
101 | + . ' from field: '.$field->name.PHP_EOL; |
|
102 | 102 | } |
103 | 103 | } |
104 | 104 | } |
@@ -207,7 +207,7 @@ |
||
207 | 207 | if (!$asset->propagating) { |
208 | 208 | // If the scenario is Asset::SCENARIO_FILEOPS treat it as a new asset |
209 | 209 | $scenario = $asset->getScenario(); |
210 | - if ($isNew || $scenario === Asset::SCENARIO_FILEOPS ) { |
|
210 | + if ($isNew || $scenario === Asset::SCENARIO_FILEOPS) { |
|
211 | 211 | /** |
212 | 212 | * If this is a newly uploaded/created Asset, we can save the variants |
213 | 213 | * via a queue job to prevent it from blocking |