@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | |
134 | 134 | $previewVersion = ''; |
135 | 135 | if ($file instanceof IVersionedPreviewFile) { |
136 | - $previewVersion = $file->getPreviewVersion() . '-'; |
|
136 | + $previewVersion = $file->getPreviewVersion().'-'; |
|
137 | 137 | } |
138 | 138 | |
139 | 139 | // Get the max preview and infer the max preview sizes from that |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | continue; |
229 | 229 | } |
230 | 230 | |
231 | - $maxWidth = (int)$this->config->getSystemValue('preview_max_x', 4096); |
|
232 | - $maxHeight = (int)$this->config->getSystemValue('preview_max_y', 4096); |
|
231 | + $maxWidth = (int) $this->config->getSystemValue('preview_max_x', 4096); |
|
232 | + $maxHeight = (int) $this->config->getSystemValue('preview_max_y', 4096); |
|
233 | 233 | |
234 | 234 | $preview = $this->helper->getThumbnail($provider, $file, $maxWidth, $maxHeight); |
235 | 235 | |
@@ -245,7 +245,7 @@ discard block |
||
245 | 245 | continue; |
246 | 246 | } |
247 | 247 | |
248 | - $path = $prefix . (string)$preview->width() . '-' . (string)$preview->height() . '-max.' . $ext; |
|
248 | + $path = $prefix.(string) $preview->width().'-'.(string) $preview->height().'-max.'.$ext; |
|
249 | 249 | try { |
250 | 250 | $file = $previewFolder->newFile($path); |
251 | 251 | $file->putContent($preview->data()); |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | */ |
268 | 268 | private function getPreviewSize(ISimpleFile $file, string $prefix = '') { |
269 | 269 | $size = explode('-', substr($file->getName(), strlen($prefix))); |
270 | - return [(int)$size[0], (int)$size[1]]; |
|
270 | + return [(int) $size[0], (int) $size[1]]; |
|
271 | 271 | } |
272 | 272 | |
273 | 273 | /** |
@@ -279,13 +279,13 @@ discard block |
||
279 | 279 | * @return string |
280 | 280 | */ |
281 | 281 | private function generatePath($width, $height, $crop, $mimeType, $prefix) { |
282 | - $path = $prefix . (string)$width . '-' . (string)$height; |
|
282 | + $path = $prefix.(string) $width.'-'.(string) $height; |
|
283 | 283 | if ($crop) { |
284 | 284 | $path .= '-crop'; |
285 | 285 | } |
286 | 286 | |
287 | 287 | $ext = $this->getExtention($mimeType); |
288 | - $path .= '.' . $ext; |
|
288 | + $path .= '.'.$ext; |
|
289 | 289 | return $path; |
290 | 290 | } |
291 | 291 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | $height /= $ratio; |
376 | 376 | } |
377 | 377 | |
378 | - return [(int)round($width), (int)round($height)]; |
|
378 | + return [(int) round($width), (int) round($height)]; |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | /** |
@@ -410,10 +410,10 @@ discard block |
||
410 | 410 | $scaleH = $maxHeight / $widthR; |
411 | 411 | $scaleW = $width; |
412 | 412 | } |
413 | - $preview = $preview->preciseResizeCopy((int)round($scaleW), (int)round($scaleH)); |
|
413 | + $preview = $preview->preciseResizeCopy((int) round($scaleW), (int) round($scaleH)); |
|
414 | 414 | } |
415 | - $cropX = (int)floor(abs($width - $preview->width()) * 0.5); |
|
416 | - $cropY = (int)floor(abs($height - $preview->height()) * 0.5); |
|
415 | + $cropX = (int) floor(abs($width - $preview->width()) * 0.5); |
|
416 | + $cropY = (int) floor(abs($height - $preview->height()) * 0.5); |
|
417 | 417 | $preview = $preview->cropCopy($cropX, $cropY, $width, $height); |
418 | 418 | } else { |
419 | 419 | $preview = $maxPreview->resizeCopy(max($width, $height)); |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | case 'image/gif': |
479 | 479 | return 'gif'; |
480 | 480 | default: |
481 | - throw new \InvalidArgumentException('Not a valid mimetype: "' . $mimeType . '"'); |
|
481 | + throw new \InvalidArgumentException('Not a valid mimetype: "'.$mimeType.'"'); |
|
482 | 482 | } |
483 | 483 | } |
484 | 484 | } |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | */ |
136 | 136 | public function widthTopLeft() { |
137 | 137 | $o = $this->getOrientation(); |
138 | - $this->logger->debug('OC_Image->widthTopLeft() Orientation: ' . $o, ['app' => 'core']); |
|
138 | + $this->logger->debug('OC_Image->widthTopLeft() Orientation: '.$o, ['app' => 'core']); |
|
139 | 139 | switch ($o) { |
140 | 140 | case -1: |
141 | 141 | case 1: |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function heightTopLeft() { |
161 | 161 | $o = $this->getOrientation(); |
162 | - $this->logger->debug('OC_Image->heightTopLeft() Orientation: ' . $o, ['app' => 'core']); |
|
162 | + $this->logger->debug('OC_Image->heightTopLeft() Orientation: '.$o, ['app' => 'core']); |
|
163 | 163 | switch ($o) { |
164 | 164 | case -1: |
165 | 165 | case 1: |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | if ($mimeType === null) { |
187 | 187 | $mimeType = $this->mimeType(); |
188 | 188 | } |
189 | - header('Content-Type: ' . $mimeType); |
|
189 | + header('Content-Type: '.$mimeType); |
|
190 | 190 | return $this->_output(null, $mimeType); |
191 | 191 | } |
192 | 192 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | } |
205 | 205 | if ($filePath === null) { |
206 | 206 | if ($this->filePath === null) { |
207 | - $this->logger->error(__METHOD__ . '(): called with no path.', ['app' => 'core']); |
|
207 | + $this->logger->error(__METHOD__.'(): called with no path.', ['app' => 'core']); |
|
208 | 208 | return false; |
209 | 209 | } else { |
210 | 210 | $filePath = $this->filePath; |
@@ -228,10 +228,10 @@ discard block |
||
228 | 228 | } |
229 | 229 | $isWritable = is_writable(dirname($filePath)); |
230 | 230 | if (!$isWritable) { |
231 | - $this->logger->error(__METHOD__ . '(): Directory \'' . dirname($filePath) . '\' is not writable.', ['app' => 'core']); |
|
231 | + $this->logger->error(__METHOD__.'(): Directory \''.dirname($filePath).'\' is not writable.', ['app' => 'core']); |
|
232 | 232 | return false; |
233 | 233 | } elseif ($isWritable && file_exists($filePath) && !is_writable($filePath)) { |
234 | - $this->logger->error(__METHOD__ . '(): File \'' . $filePath . '\' is not writable.', ['app' => 'core']); |
|
234 | + $this->logger->error(__METHOD__.'(): File \''.$filePath.'\' is not writable.', ['app' => 'core']); |
|
235 | 235 | return false; |
236 | 236 | } |
237 | 237 | } |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | $imageType = IMAGETYPE_BMP; |
260 | 260 | break; |
261 | 261 | default: |
262 | - throw new Exception('\OC_Image::_output(): "' . $mimeType . '" is not supported when forcing a specific output format'); |
|
262 | + throw new Exception('\OC_Image::_output(): "'.$mimeType.'" is not supported when forcing a specific output format'); |
|
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
@@ -438,7 +438,7 @@ discard block |
||
438 | 438 | return; |
439 | 439 | } |
440 | 440 | |
441 | - $exif = @exif_read_data('data://image/jpeg;base64,' . base64_encode($data)); |
|
441 | + $exif = @exif_read_data('data://image/jpeg;base64,'.base64_encode($data)); |
|
442 | 442 | if (!$exif) { |
443 | 443 | return; |
444 | 444 | } |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | */ |
457 | 457 | public function fixOrientation() { |
458 | 458 | $o = $this->getOrientation(); |
459 | - $this->logger->debug('OC_Image->fixOrientation() Orientation: ' . $o, ['app' => 'core']); |
|
459 | + $this->logger->debug('OC_Image->fixOrientation() Orientation: '.$o, ['app' => 'core']); |
|
460 | 460 | $rotate = 0; |
461 | 461 | $flip = false; |
462 | 462 | switch ($o) { |
@@ -491,7 +491,7 @@ discard block |
||
491 | 491 | $rotate = 90; |
492 | 492 | break; |
493 | 493 | } |
494 | - if($flip && function_exists('imageflip')) { |
|
494 | + if ($flip && function_exists('imageflip')) { |
|
495 | 495 | imageflip($this->resource, IMG_FLIP_HORIZONTAL); |
496 | 496 | } |
497 | 497 | if ($rotate) { |
@@ -553,7 +553,7 @@ discard block |
||
553 | 553 | imagealphablending($this->resource, true); |
554 | 554 | imagesavealpha($this->resource, true); |
555 | 555 | } else { |
556 | - $this->logger->debug('OC_Image->loadFromFile, GIF images not supported: ' . $imagePath, ['app' => 'core']); |
|
556 | + $this->logger->debug('OC_Image->loadFromFile, GIF images not supported: '.$imagePath, ['app' => 'core']); |
|
557 | 557 | } |
558 | 558 | break; |
559 | 559 | case IMAGETYPE_JPEG: |
@@ -561,10 +561,10 @@ discard block |
||
561 | 561 | if (getimagesize($imagePath) !== false) { |
562 | 562 | $this->resource = @imagecreatefromjpeg($imagePath); |
563 | 563 | } else { |
564 | - $this->logger->debug('OC_Image->loadFromFile, JPG image not valid: ' . $imagePath, ['app' => 'core']); |
|
564 | + $this->logger->debug('OC_Image->loadFromFile, JPG image not valid: '.$imagePath, ['app' => 'core']); |
|
565 | 565 | } |
566 | 566 | } else { |
567 | - $this->logger->debug('OC_Image->loadFromFile, JPG images not supported: ' . $imagePath, ['app' => 'core']); |
|
567 | + $this->logger->debug('OC_Image->loadFromFile, JPG images not supported: '.$imagePath, ['app' => 'core']); |
|
568 | 568 | } |
569 | 569 | break; |
570 | 570 | case IMAGETYPE_PNG: |
@@ -574,21 +574,21 @@ discard block |
||
574 | 574 | imagealphablending($this->resource, true); |
575 | 575 | imagesavealpha($this->resource, true); |
576 | 576 | } else { |
577 | - $this->logger->debug('OC_Image->loadFromFile, PNG images not supported: ' . $imagePath, ['app' => 'core']); |
|
577 | + $this->logger->debug('OC_Image->loadFromFile, PNG images not supported: '.$imagePath, ['app' => 'core']); |
|
578 | 578 | } |
579 | 579 | break; |
580 | 580 | case IMAGETYPE_XBM: |
581 | 581 | if (imagetypes() & IMG_XPM) { |
582 | 582 | $this->resource = @imagecreatefromxbm($imagePath); |
583 | 583 | } else { |
584 | - $this->logger->debug('OC_Image->loadFromFile, XBM/XPM images not supported: ' . $imagePath, ['app' => 'core']); |
|
584 | + $this->logger->debug('OC_Image->loadFromFile, XBM/XPM images not supported: '.$imagePath, ['app' => 'core']); |
|
585 | 585 | } |
586 | 586 | break; |
587 | 587 | case IMAGETYPE_WBMP: |
588 | 588 | if (imagetypes() & IMG_WBMP) { |
589 | 589 | $this->resource = @imagecreatefromwbmp($imagePath); |
590 | 590 | } else { |
591 | - $this->logger->debug('OC_Image->loadFromFile, WBMP images not supported: ' . $imagePath, ['app' => 'core']); |
|
591 | + $this->logger->debug('OC_Image->loadFromFile, WBMP images not supported: '.$imagePath, ['app' => 'core']); |
|
592 | 592 | } |
593 | 593 | break; |
594 | 594 | case IMAGETYPE_BMP: |
@@ -698,7 +698,7 @@ discard block |
||
698 | 698 | */ |
699 | 699 | private function imagecreatefrombmp($fileName) { |
700 | 700 | if (!($fh = fopen($fileName, 'rb'))) { |
701 | - $this->logger->warning('imagecreatefrombmp: Can not open ' . $fileName, ['app' => 'core']); |
|
701 | + $this->logger->warning('imagecreatefrombmp: Can not open '.$fileName, ['app' => 'core']); |
|
702 | 702 | return false; |
703 | 703 | } |
704 | 704 | // read file header |
@@ -706,7 +706,7 @@ discard block |
||
706 | 706 | // check for bitmap |
707 | 707 | if ($meta['type'] != 19778) { |
708 | 708 | fclose($fh); |
709 | - $this->logger->warning('imagecreatefrombmp: Can not open ' . $fileName . ' is not a bitmap!', ['app' => 'core']); |
|
709 | + $this->logger->warning('imagecreatefrombmp: Can not open '.$fileName.' is not a bitmap!', ['app' => 'core']); |
|
710 | 710 | return false; |
711 | 711 | } |
712 | 712 | // read image header |
@@ -730,7 +730,7 @@ discard block |
||
730 | 730 | $meta['imagesize'] = @filesize($fileName) - $meta['offset']; |
731 | 731 | if ($meta['imagesize'] < 1) { |
732 | 732 | fclose($fh); |
733 | - $this->logger->warning('imagecreatefrombmp: Can not obtain file size of ' . $fileName . ' is not a bitmap!', ['app' => 'core']); |
|
733 | + $this->logger->warning('imagecreatefrombmp: Can not obtain file size of '.$fileName.' is not a bitmap!', ['app' => 'core']); |
|
734 | 734 | return false; |
735 | 735 | } |
736 | 736 | } |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | // read color palette |
741 | 741 | $palette = []; |
742 | 742 | if ($meta['bits'] < 16) { |
743 | - $palette = unpack('l' . $meta['colors'], fread($fh, $meta['colors'] * 4)); |
|
743 | + $palette = unpack('l'.$meta['colors'], fread($fh, $meta['colors'] * 4)); |
|
744 | 744 | // in rare cases the color value is signed |
745 | 745 | if ($palette[1] < 0) { |
746 | 746 | foreach ($palette as $i => $color) { |
@@ -753,7 +753,7 @@ discard block |
||
753 | 753 | if ($im == false) { |
754 | 754 | fclose($fh); |
755 | 755 | $this->logger->warning( |
756 | - 'imagecreatefrombmp: imagecreatetruecolor failed for file "' . $fileName . '" with dimensions ' . $meta['width'] . 'x' . $meta['height'], |
|
756 | + 'imagecreatefrombmp: imagecreatetruecolor failed for file "'.$fileName.'" with dimensions '.$meta['width'].'x'.$meta['height'], |
|
757 | 757 | ['app' => 'core']); |
758 | 758 | return false; |
759 | 759 | } |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | $p = 0; |
763 | 763 | $vide = chr(0); |
764 | 764 | $y = $meta['height'] - 1; |
765 | - $error = 'imagecreatefrombmp: ' . $fileName . ' has not enough data!'; |
|
765 | + $error = 'imagecreatefrombmp: '.$fileName.' has not enough data!'; |
|
766 | 766 | // loop through the image data beginning with the lower left corner |
767 | 767 | while ($y >= 0) { |
768 | 768 | $x = 0; |
@@ -774,7 +774,7 @@ discard block |
||
774 | 774 | $this->logger->warning($error, ['app' => 'core']); |
775 | 775 | return $im; |
776 | 776 | } |
777 | - $color = @unpack('V', $part . $vide); |
|
777 | + $color = @unpack('V', $part.$vide); |
|
778 | 778 | break; |
779 | 779 | case 16: |
780 | 780 | if (!($part = substr($data, $p, 2))) { |
@@ -786,16 +786,16 @@ discard block |
||
786 | 786 | $color[1] = (($color[1] & 0xf800) >> 8) * 65536 + (($color[1] & 0x07e0) >> 3) * 256 + (($color[1] & 0x001f) << 3); |
787 | 787 | break; |
788 | 788 | case 8: |
789 | - $color = @unpack('n', $vide . ($data[$p] ?? '')); |
|
789 | + $color = @unpack('n', $vide.($data[$p] ?? '')); |
|
790 | 790 | $color[1] = isset($palette[$color[1] + 1]) ? $palette[$color[1] + 1] : $palette[1]; |
791 | 791 | break; |
792 | 792 | case 4: |
793 | - $color = @unpack('n', $vide . ($data[floor($p)] ?? '')); |
|
793 | + $color = @unpack('n', $vide.($data[floor($p)] ?? '')); |
|
794 | 794 | $color[1] = ($p * 2) % 2 == 0 ? $color[1] >> 4 : $color[1] & 0x0F; |
795 | 795 | $color[1] = isset($palette[$color[1] + 1]) ? $palette[$color[1] + 1] : $palette[1]; |
796 | 796 | break; |
797 | 797 | case 1: |
798 | - $color = @unpack('n', $vide . ($data[floor($p)] ?? '')); |
|
798 | + $color = @unpack('n', $vide.($data[floor($p)] ?? '')); |
|
799 | 799 | switch (($p * 8) % 8) { |
800 | 800 | case 0: |
801 | 801 | $color[1] = $color[1] >> 7; |
@@ -826,7 +826,7 @@ discard block |
||
826 | 826 | break; |
827 | 827 | default: |
828 | 828 | fclose($fh); |
829 | - $this->logger->warning('imagecreatefrombmp: ' . $fileName . ' has ' . $meta['bits'] . ' bits and this is not supported!', ['app' => 'core']); |
|
829 | + $this->logger->warning('imagecreatefrombmp: '.$fileName.' has '.$meta['bits'].' bits and this is not supported!', ['app' => 'core']); |
|
830 | 830 | return false; |
831 | 831 | } |
832 | 832 | imagesetpixel($im, $x, $y, $color[1]); |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | */ |
860 | 860 | private function resizeNew($maxSize) { |
861 | 861 | if (!$this->valid()) { |
862 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
862 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
863 | 863 | return false; |
864 | 864 | } |
865 | 865 | $widthOrig = imagesx($this->resource); |
@@ -874,7 +874,7 @@ discard block |
||
874 | 874 | $newHeight = $maxSize; |
875 | 875 | } |
876 | 876 | |
877 | - return $this->preciseResizeNew((int)round($newWidth), (int)round($newHeight)); |
|
877 | + return $this->preciseResizeNew((int) round($newWidth), (int) round($newHeight)); |
|
878 | 878 | } |
879 | 879 | |
880 | 880 | /** |
@@ -897,14 +897,14 @@ discard block |
||
897 | 897 | */ |
898 | 898 | public function preciseResizeNew(int $width, int $height) { |
899 | 899 | if (!$this->valid()) { |
900 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
900 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
901 | 901 | return false; |
902 | 902 | } |
903 | 903 | $widthOrig = imagesx($this->resource); |
904 | 904 | $heightOrig = imagesy($this->resource); |
905 | 905 | $process = imagecreatetruecolor($width, $height); |
906 | 906 | if ($process === false) { |
907 | - $this->logger->error(__METHOD__ . '(): Error creating true color image', ['app' => 'core']); |
|
907 | + $this->logger->error(__METHOD__.'(): Error creating true color image', ['app' => 'core']); |
|
908 | 908 | return false; |
909 | 909 | } |
910 | 910 | |
@@ -917,7 +917,7 @@ discard block |
||
917 | 917 | |
918 | 918 | $res = imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig); |
919 | 919 | if ($res === false) { |
920 | - $this->logger->error(__METHOD__ . '(): Error re-sampling process image', ['app' => 'core']); |
|
920 | + $this->logger->error(__METHOD__.'(): Error re-sampling process image', ['app' => 'core']); |
|
921 | 921 | imagedestroy($process); |
922 | 922 | return false; |
923 | 923 | } |
@@ -973,7 +973,7 @@ discard block |
||
973 | 973 | |
974 | 974 | imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height); |
975 | 975 | if ($process == false) { |
976 | - $this->logger->error('OC_Image->centerCrop, Error re-sampling process image ' . $width . 'x' . $height, ['app' => 'core']); |
|
976 | + $this->logger->error('OC_Image->centerCrop, Error re-sampling process image '.$width.'x'.$height, ['app' => 'core']); |
|
977 | 977 | imagedestroy($process); |
978 | 978 | return false; |
979 | 979 | } |
@@ -1009,12 +1009,12 @@ discard block |
||
1009 | 1009 | */ |
1010 | 1010 | public function cropNew(int $x, int $y, int $w, int $h) { |
1011 | 1011 | if (!$this->valid()) { |
1012 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
1012 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
1013 | 1013 | return false; |
1014 | 1014 | } |
1015 | 1015 | $process = imagecreatetruecolor($w, $h); |
1016 | 1016 | if ($process == false) { |
1017 | - $this->logger->error(__METHOD__ . '(): Error creating true color image', ['app' => 'core']); |
|
1017 | + $this->logger->error(__METHOD__.'(): Error creating true color image', ['app' => 'core']); |
|
1018 | 1018 | imagedestroy($process); |
1019 | 1019 | return false; |
1020 | 1020 | } |
@@ -1028,7 +1028,7 @@ discard block |
||
1028 | 1028 | |
1029 | 1029 | imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $w, $h, $w, $h); |
1030 | 1030 | if ($process == false) { |
1031 | - $this->logger->error(__METHOD__ . '(): Error re-sampling process image ' . $w . 'x' . $h, ['app' => 'core']); |
|
1031 | + $this->logger->error(__METHOD__.'(): Error re-sampling process image '.$w.'x'.$h, ['app' => 'core']); |
|
1032 | 1032 | imagedestroy($process); |
1033 | 1033 | return false; |
1034 | 1034 | } |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | */ |
1047 | 1047 | public function fitIn($maxWidth, $maxHeight) { |
1048 | 1048 | if (!$this->valid()) { |
1049 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
1049 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
1050 | 1050 | return false; |
1051 | 1051 | } |
1052 | 1052 | $widthOrig = imagesx($this->resource); |
@@ -1056,7 +1056,7 @@ discard block |
||
1056 | 1056 | $newWidth = min($maxWidth, $ratio * $maxHeight); |
1057 | 1057 | $newHeight = min($maxHeight, $maxWidth / $ratio); |
1058 | 1058 | |
1059 | - $this->preciseResize((int)round($newWidth), (int)round($newHeight)); |
|
1059 | + $this->preciseResize((int) round($newWidth), (int) round($newHeight)); |
|
1060 | 1060 | return true; |
1061 | 1061 | } |
1062 | 1062 | |
@@ -1069,7 +1069,7 @@ discard block |
||
1069 | 1069 | */ |
1070 | 1070 | public function scaleDownToFit($maxWidth, $maxHeight) { |
1071 | 1071 | if (!$this->valid()) { |
1072 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
1072 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
1073 | 1073 | return false; |
1074 | 1074 | } |
1075 | 1075 | $widthOrig = imagesx($this->resource); |
@@ -1176,7 +1176,7 @@ discard block |
||
1176 | 1176 | if ($bit <= 8) { |
1177 | 1177 | for ($i = 0; $i < $colorsNum; $i++) { |
1178 | 1178 | $colors = imagecolorsforindex($im, $i); |
1179 | - $rgbQuad .= chr($colors['blue']) . chr($colors['green']) . chr($colors['red']) . "\0"; |
|
1179 | + $rgbQuad .= chr($colors['blue']).chr($colors['green']).chr($colors['red'])."\0"; |
|
1180 | 1180 | } |
1181 | 1181 | $bmpData = ''; |
1182 | 1182 | if ($compression == 0 || $bit < 8) { |
@@ -1209,7 +1209,7 @@ discard block |
||
1209 | 1209 | $index = imagecolorat($im, $i, $j); |
1210 | 1210 | if ($index !== $lastIndex || $sameNum > 255) { |
1211 | 1211 | if ($sameNum != 0) { |
1212 | - $bmpData .= chr($sameNum) . chr($lastIndex); |
|
1212 | + $bmpData .= chr($sameNum).chr($lastIndex); |
|
1213 | 1213 | } |
1214 | 1214 | $lastIndex = $index; |
1215 | 1215 | $sameNum = 1; |
@@ -1250,15 +1250,15 @@ discard block |
||
1250 | 1250 | $sizeData = strlen($bmpData); |
1251 | 1251 | $colorsNum = 0; |
1252 | 1252 | } |
1253 | - $fileHeader = 'BM' . pack('V3', 54 + $sizeQuad + $sizeData, 0, 54 + $sizeQuad); |
|
1253 | + $fileHeader = 'BM'.pack('V3', 54 + $sizeQuad + $sizeData, 0, 54 + $sizeQuad); |
|
1254 | 1254 | $infoHeader = pack('V3v2V*', 0x28, $width, $height, 1, $bit, $compression, $sizeData, 0, 0, $colorsNum, 0); |
1255 | 1255 | if ($fileName != '') { |
1256 | 1256 | $fp = fopen($fileName, 'wb'); |
1257 | - fwrite($fp, $fileHeader . $infoHeader . $rgbQuad . $bmpData); |
|
1257 | + fwrite($fp, $fileHeader.$infoHeader.$rgbQuad.$bmpData); |
|
1258 | 1258 | fclose($fp); |
1259 | 1259 | return true; |
1260 | 1260 | } |
1261 | - echo $fileHeader . $infoHeader . $rgbQuad . $bmpData; |
|
1261 | + echo $fileHeader.$infoHeader.$rgbQuad.$bmpData; |
|
1262 | 1262 | return true; |
1263 | 1263 | } |
1264 | 1264 | } |