@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | */ |
160 | 160 | public function widthTopLeft() { |
161 | 161 | $o = $this->getOrientation(); |
162 | - $this->logger->debug('OC_Image->widthTopLeft() Orientation: ' . $o, ['app' => 'core']); |
|
162 | + $this->logger->debug('OC_Image->widthTopLeft() Orientation: '.$o, ['app' => 'core']); |
|
163 | 163 | switch ($o) { |
164 | 164 | case -1: |
165 | 165 | case 1: |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | */ |
184 | 184 | public function heightTopLeft() { |
185 | 185 | $o = $this->getOrientation(); |
186 | - $this->logger->debug('OC_Image->heightTopLeft() Orientation: ' . $o, ['app' => 'core']); |
|
186 | + $this->logger->debug('OC_Image->heightTopLeft() Orientation: '.$o, ['app' => 'core']); |
|
187 | 187 | switch ($o) { |
188 | 188 | case -1: |
189 | 189 | case 1: |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | if ($mimeType === null) { |
211 | 211 | $mimeType = $this->mimeType(); |
212 | 212 | } |
213 | - header('Content-Type: ' . $mimeType); |
|
213 | + header('Content-Type: '.$mimeType); |
|
214 | 214 | return $this->_output(null, $mimeType); |
215 | 215 | } |
216 | 216 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | } |
229 | 229 | if ($filePath === null) { |
230 | 230 | if ($this->filePath === null) { |
231 | - $this->logger->error(__METHOD__ . '(): called with no path.', ['app' => 'core']); |
|
231 | + $this->logger->error(__METHOD__.'(): called with no path.', ['app' => 'core']); |
|
232 | 232 | return false; |
233 | 233 | } else { |
234 | 234 | $filePath = $this->filePath; |
@@ -252,10 +252,10 @@ discard block |
||
252 | 252 | } |
253 | 253 | $isWritable = is_writable(dirname($filePath)); |
254 | 254 | if (!$isWritable) { |
255 | - $this->logger->error(__METHOD__ . '(): Directory \'' . dirname($filePath) . '\' is not writable.', ['app' => 'core']); |
|
255 | + $this->logger->error(__METHOD__.'(): Directory \''.dirname($filePath).'\' is not writable.', ['app' => 'core']); |
|
256 | 256 | return false; |
257 | 257 | } elseif ($isWritable && file_exists($filePath) && !is_writable($filePath)) { |
258 | - $this->logger->error(__METHOD__ . '(): File \'' . $filePath . '\' is not writable.', ['app' => 'core']); |
|
258 | + $this->logger->error(__METHOD__.'(): File \''.$filePath.'\' is not writable.', ['app' => 'core']); |
|
259 | 259 | return false; |
260 | 260 | } |
261 | 261 | } |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | $imageType = IMAGETYPE_BMP; |
284 | 284 | break; |
285 | 285 | default: |
286 | - throw new Exception('\OC_Image::_output(): "' . $mimeType . '" is not supported when forcing a specific output format'); |
|
286 | + throw new Exception('\OC_Image::_output(): "'.$mimeType.'" is not supported when forcing a specific output format'); |
|
287 | 287 | } |
288 | 288 | } |
289 | 289 | |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | return; |
469 | 469 | } |
470 | 470 | |
471 | - $exif = @exif_read_data('data://image/jpeg;base64,' . base64_encode($data)); |
|
471 | + $exif = @exif_read_data('data://image/jpeg;base64,'.base64_encode($data)); |
|
472 | 472 | if (!$exif) { |
473 | 473 | return; |
474 | 474 | } |
@@ -486,11 +486,11 @@ discard block |
||
486 | 486 | */ |
487 | 487 | public function fixOrientation() { |
488 | 488 | if (!$this->valid()) { |
489 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
489 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
490 | 490 | return false; |
491 | 491 | } |
492 | 492 | $o = $this->getOrientation(); |
493 | - $this->logger->debug('OC_Image->fixOrientation() Orientation: ' . $o, ['app' => 'core']); |
|
493 | + $this->logger->debug('OC_Image->fixOrientation() Orientation: '.$o, ['app' => 'core']); |
|
494 | 494 | $rotate = 0; |
495 | 495 | $flip = false; |
496 | 496 | switch ($o) { |
@@ -583,7 +583,7 @@ discard block |
||
583 | 583 | |
584 | 584 | // Assume 32 bits per pixel. |
585 | 585 | if ($width * $height * 4 > $memory_limit * 1024 * 1024) { |
586 | - $this->logger->debug('Image size of ' . $width . 'x' . $height . ' would exceed allowed memory limit of ' . $memory_limit); |
|
586 | + $this->logger->debug('Image size of '.$width.'x'.$height.' would exceed allowed memory limit of '.$memory_limit); |
|
587 | 587 | return false; |
588 | 588 | } |
589 | 589 | |
@@ -656,10 +656,10 @@ discard block |
||
656 | 656 | imagealphablending($this->resource, true); |
657 | 657 | imagesavealpha($this->resource, true); |
658 | 658 | } else { |
659 | - $this->logger->debug('OC_Image->loadFromFile, GIF image not valid: ' . $imagePath, ['app' => 'core']); |
|
659 | + $this->logger->debug('OC_Image->loadFromFile, GIF image not valid: '.$imagePath, ['app' => 'core']); |
|
660 | 660 | } |
661 | 661 | } else { |
662 | - $this->logger->debug('OC_Image->loadFromFile, GIF images not supported: ' . $imagePath, ['app' => 'core']); |
|
662 | + $this->logger->debug('OC_Image->loadFromFile, GIF images not supported: '.$imagePath, ['app' => 'core']); |
|
663 | 663 | } |
664 | 664 | break; |
665 | 665 | case IMAGETYPE_JPEG: |
@@ -670,10 +670,10 @@ discard block |
||
670 | 670 | if (getimagesize($imagePath) !== false) { |
671 | 671 | $this->resource = @imagecreatefromjpeg($imagePath); |
672 | 672 | } else { |
673 | - $this->logger->debug('OC_Image->loadFromFile, JPG image not valid: ' . $imagePath, ['app' => 'core']); |
|
673 | + $this->logger->debug('OC_Image->loadFromFile, JPG image not valid: '.$imagePath, ['app' => 'core']); |
|
674 | 674 | } |
675 | 675 | } else { |
676 | - $this->logger->debug('OC_Image->loadFromFile, JPG images not supported: ' . $imagePath, ['app' => 'core']); |
|
676 | + $this->logger->debug('OC_Image->loadFromFile, JPG images not supported: '.$imagePath, ['app' => 'core']); |
|
677 | 677 | } |
678 | 678 | break; |
679 | 679 | case IMAGETYPE_PNG: |
@@ -687,10 +687,10 @@ discard block |
||
687 | 687 | imagealphablending($this->resource, true); |
688 | 688 | imagesavealpha($this->resource, true); |
689 | 689 | } else { |
690 | - $this->logger->debug('OC_Image->loadFromFile, PNG image not valid: ' . $imagePath, ['app' => 'core']); |
|
690 | + $this->logger->debug('OC_Image->loadFromFile, PNG image not valid: '.$imagePath, ['app' => 'core']); |
|
691 | 691 | } |
692 | 692 | } else { |
693 | - $this->logger->debug('OC_Image->loadFromFile, PNG images not supported: ' . $imagePath, ['app' => 'core']); |
|
693 | + $this->logger->debug('OC_Image->loadFromFile, PNG images not supported: '.$imagePath, ['app' => 'core']); |
|
694 | 694 | } |
695 | 695 | break; |
696 | 696 | case IMAGETYPE_XBM: |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | } |
701 | 701 | $this->resource = @imagecreatefromxbm($imagePath); |
702 | 702 | } else { |
703 | - $this->logger->debug('OC_Image->loadFromFile, XBM/XPM images not supported: ' . $imagePath, ['app' => 'core']); |
|
703 | + $this->logger->debug('OC_Image->loadFromFile, XBM/XPM images not supported: '.$imagePath, ['app' => 'core']); |
|
704 | 704 | } |
705 | 705 | break; |
706 | 706 | case IMAGETYPE_WBMP: |
@@ -710,7 +710,7 @@ discard block |
||
710 | 710 | } |
711 | 711 | $this->resource = @imagecreatefromwbmp($imagePath); |
712 | 712 | } else { |
713 | - $this->logger->debug('OC_Image->loadFromFile, WBMP images not supported: ' . $imagePath, ['app' => 'core']); |
|
713 | + $this->logger->debug('OC_Image->loadFromFile, WBMP images not supported: '.$imagePath, ['app' => 'core']); |
|
714 | 714 | } |
715 | 715 | break; |
716 | 716 | case IMAGETYPE_BMP: |
@@ -723,7 +723,7 @@ discard block |
||
723 | 723 | } |
724 | 724 | $this->resource = @imagecreatefromwebp($imagePath); |
725 | 725 | } else { |
726 | - $this->logger->debug('OC_Image->loadFromFile, webp images not supported: ' . $imagePath, ['app' => 'core']); |
|
726 | + $this->logger->debug('OC_Image->loadFromFile, webp images not supported: '.$imagePath, ['app' => 'core']); |
|
727 | 727 | } |
728 | 728 | break; |
729 | 729 | /* |
@@ -840,7 +840,7 @@ discard block |
||
840 | 840 | */ |
841 | 841 | private function imagecreatefrombmp($fileName) { |
842 | 842 | if (!($fh = fopen($fileName, 'rb'))) { |
843 | - $this->logger->warning('imagecreatefrombmp: Can not open ' . $fileName, ['app' => 'core']); |
|
843 | + $this->logger->warning('imagecreatefrombmp: Can not open '.$fileName, ['app' => 'core']); |
|
844 | 844 | return false; |
845 | 845 | } |
846 | 846 | // read file header |
@@ -848,7 +848,7 @@ discard block |
||
848 | 848 | // check for bitmap |
849 | 849 | if ($meta['type'] != 19778) { |
850 | 850 | fclose($fh); |
851 | - $this->logger->warning('imagecreatefrombmp: Can not open ' . $fileName . ' is not a bitmap!', ['app' => 'core']); |
|
851 | + $this->logger->warning('imagecreatefrombmp: Can not open '.$fileName.' is not a bitmap!', ['app' => 'core']); |
|
852 | 852 | return false; |
853 | 853 | } |
854 | 854 | // read image header |
@@ -872,7 +872,7 @@ discard block |
||
872 | 872 | $meta['imagesize'] = @filesize($fileName) - $meta['offset']; |
873 | 873 | if ($meta['imagesize'] < 1) { |
874 | 874 | fclose($fh); |
875 | - $this->logger->warning('imagecreatefrombmp: Can not obtain file size of ' . $fileName . ' is not a bitmap!', ['app' => 'core']); |
|
875 | + $this->logger->warning('imagecreatefrombmp: Can not obtain file size of '.$fileName.' is not a bitmap!', ['app' => 'core']); |
|
876 | 876 | return false; |
877 | 877 | } |
878 | 878 | } |
@@ -882,7 +882,7 @@ discard block |
||
882 | 882 | // read color palette |
883 | 883 | $palette = []; |
884 | 884 | if ($meta['bits'] < 16) { |
885 | - $palette = unpack('l' . $meta['colors'], fread($fh, $meta['colors'] * 4)); |
|
885 | + $palette = unpack('l'.$meta['colors'], fread($fh, $meta['colors'] * 4)); |
|
886 | 886 | // in rare cases the color value is signed |
887 | 887 | if ($palette[1] < 0) { |
888 | 888 | foreach ($palette as $i => $color) { |
@@ -899,7 +899,7 @@ discard block |
||
899 | 899 | if ($im == false) { |
900 | 900 | fclose($fh); |
901 | 901 | $this->logger->warning( |
902 | - 'imagecreatefrombmp: imagecreatetruecolor failed for file "' . $fileName . '" with dimensions ' . $meta['width'] . 'x' . $meta['height'], |
|
902 | + 'imagecreatefrombmp: imagecreatetruecolor failed for file "'.$fileName.'" with dimensions '.$meta['width'].'x'.$meta['height'], |
|
903 | 903 | ['app' => 'core']); |
904 | 904 | return false; |
905 | 905 | } |
@@ -908,7 +908,7 @@ discard block |
||
908 | 908 | $p = 0; |
909 | 909 | $vide = chr(0); |
910 | 910 | $y = $meta['height'] - 1; |
911 | - $error = 'imagecreatefrombmp: ' . $fileName . ' has not enough data!'; |
|
911 | + $error = 'imagecreatefrombmp: '.$fileName.' has not enough data!'; |
|
912 | 912 | // loop through the image data beginning with the lower left corner |
913 | 913 | while ($y >= 0) { |
914 | 914 | $x = 0; |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | $this->logger->warning($error, ['app' => 'core']); |
921 | 921 | return $im; |
922 | 922 | } |
923 | - $color = @unpack('V', $part . $vide); |
|
923 | + $color = @unpack('V', $part.$vide); |
|
924 | 924 | break; |
925 | 925 | case 16: |
926 | 926 | if (!($part = substr($data, $p, 2))) { |
@@ -932,16 +932,16 @@ discard block |
||
932 | 932 | $color[1] = (($color[1] & 0xf800) >> 8) * 65536 + (($color[1] & 0x07e0) >> 3) * 256 + (($color[1] & 0x001f) << 3); |
933 | 933 | break; |
934 | 934 | case 8: |
935 | - $color = @unpack('n', $vide . ($data[$p] ?? '')); |
|
935 | + $color = @unpack('n', $vide.($data[$p] ?? '')); |
|
936 | 936 | $color[1] = isset($palette[$color[1] + 1]) ? $palette[$color[1] + 1] : $palette[1]; |
937 | 937 | break; |
938 | 938 | case 4: |
939 | - $color = @unpack('n', $vide . ($data[floor($p)] ?? '')); |
|
939 | + $color = @unpack('n', $vide.($data[floor($p)] ?? '')); |
|
940 | 940 | $color[1] = ($p * 2) % 2 == 0 ? $color[1] >> 4 : $color[1] & 0x0F; |
941 | 941 | $color[1] = isset($palette[$color[1] + 1]) ? $palette[$color[1] + 1] : $palette[1]; |
942 | 942 | break; |
943 | 943 | case 1: |
944 | - $color = @unpack('n', $vide . ($data[floor($p)] ?? '')); |
|
944 | + $color = @unpack('n', $vide.($data[floor($p)] ?? '')); |
|
945 | 945 | switch (($p * 8) % 8) { |
946 | 946 | case 0: |
947 | 947 | $color[1] = $color[1] >> 7; |
@@ -972,7 +972,7 @@ discard block |
||
972 | 972 | break; |
973 | 973 | default: |
974 | 974 | fclose($fh); |
975 | - $this->logger->warning('imagecreatefrombmp: ' . $fileName . ' has ' . $meta['bits'] . ' bits and this is not supported!', ['app' => 'core']); |
|
975 | + $this->logger->warning('imagecreatefrombmp: '.$fileName.' has '.$meta['bits'].' bits and this is not supported!', ['app' => 'core']); |
|
976 | 976 | return false; |
977 | 977 | } |
978 | 978 | imagesetpixel($im, $x, $y, $color[1]); |
@@ -994,7 +994,7 @@ discard block |
||
994 | 994 | */ |
995 | 995 | public function resize($maxSize) { |
996 | 996 | if (!$this->valid()) { |
997 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
997 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
998 | 998 | return false; |
999 | 999 | } |
1000 | 1000 | $result = $this->resizeNew($maxSize); |
@@ -1009,7 +1009,7 @@ discard block |
||
1009 | 1009 | */ |
1010 | 1010 | private function resizeNew($maxSize) { |
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 | $widthOrig = imagesx($this->resource); |
@@ -1024,7 +1024,7 @@ discard block |
||
1024 | 1024 | $newHeight = $maxSize; |
1025 | 1025 | } |
1026 | 1026 | |
1027 | - return $this->preciseResizeNew((int)round($newWidth), (int)round($newHeight)); |
|
1027 | + return $this->preciseResizeNew((int) round($newWidth), (int) round($newHeight)); |
|
1028 | 1028 | } |
1029 | 1029 | |
1030 | 1030 | /** |
@@ -1034,7 +1034,7 @@ discard block |
||
1034 | 1034 | */ |
1035 | 1035 | public function preciseResize(int $width, int $height): bool { |
1036 | 1036 | if (!$this->valid()) { |
1037 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
1037 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
1038 | 1038 | return false; |
1039 | 1039 | } |
1040 | 1040 | $result = $this->preciseResizeNew($width, $height); |
@@ -1051,18 +1051,18 @@ discard block |
||
1051 | 1051 | */ |
1052 | 1052 | public function preciseResizeNew(int $width, int $height) { |
1053 | 1053 | if (!($width > 0) || !($height > 0)) { |
1054 | - $this->logger->info(__METHOD__ . '(): Requested image size not bigger than 0', ['app' => 'core']); |
|
1054 | + $this->logger->info(__METHOD__.'(): Requested image size not bigger than 0', ['app' => 'core']); |
|
1055 | 1055 | return false; |
1056 | 1056 | } |
1057 | 1057 | if (!$this->valid()) { |
1058 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
1058 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
1059 | 1059 | return false; |
1060 | 1060 | } |
1061 | 1061 | $widthOrig = imagesx($this->resource); |
1062 | 1062 | $heightOrig = imagesy($this->resource); |
1063 | 1063 | $process = imagecreatetruecolor($width, $height); |
1064 | 1064 | if ($process === false) { |
1065 | - $this->logger->error(__METHOD__ . '(): Error creating true color image', ['app' => 'core']); |
|
1065 | + $this->logger->error(__METHOD__.'(): Error creating true color image', ['app' => 'core']); |
|
1066 | 1066 | return false; |
1067 | 1067 | } |
1068 | 1068 | |
@@ -1075,7 +1075,7 @@ discard block |
||
1075 | 1075 | |
1076 | 1076 | $res = imagecopyresampled($process, $this->resource, 0, 0, 0, 0, $width, $height, $widthOrig, $heightOrig); |
1077 | 1077 | if ($res === false) { |
1078 | - $this->logger->error(__METHOD__ . '(): Error re-sampling process image', ['app' => 'core']); |
|
1078 | + $this->logger->error(__METHOD__.'(): Error re-sampling process image', ['app' => 'core']); |
|
1079 | 1079 | imagedestroy($process); |
1080 | 1080 | return false; |
1081 | 1081 | } |
@@ -1130,7 +1130,7 @@ discard block |
||
1130 | 1130 | |
1131 | 1131 | imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $targetWidth, $targetHeight, $width, $height); |
1132 | 1132 | if ($process === false) { |
1133 | - $this->logger->error('OC_Image->centerCrop, Error re-sampling process image ' . $width . 'x' . $height, ['app' => 'core']); |
|
1133 | + $this->logger->error('OC_Image->centerCrop, Error re-sampling process image '.$width.'x'.$height, ['app' => 'core']); |
|
1134 | 1134 | return false; |
1135 | 1135 | } |
1136 | 1136 | imagedestroy($this->resource); |
@@ -1149,7 +1149,7 @@ discard block |
||
1149 | 1149 | */ |
1150 | 1150 | public function crop(int $x, int $y, int $w, int $h): bool { |
1151 | 1151 | if (!$this->valid()) { |
1152 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
1152 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
1153 | 1153 | return false; |
1154 | 1154 | } |
1155 | 1155 | $result = $this->cropNew($x, $y, $w, $h); |
@@ -1169,12 +1169,12 @@ discard block |
||
1169 | 1169 | */ |
1170 | 1170 | public function cropNew(int $x, int $y, int $w, int $h) { |
1171 | 1171 | if (!$this->valid()) { |
1172 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
1172 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
1173 | 1173 | return false; |
1174 | 1174 | } |
1175 | 1175 | $process = imagecreatetruecolor($w, $h); |
1176 | 1176 | if ($process === false) { |
1177 | - $this->logger->error(__METHOD__ . '(): Error creating true color image', ['app' => 'core']); |
|
1177 | + $this->logger->error(__METHOD__.'(): Error creating true color image', ['app' => 'core']); |
|
1178 | 1178 | return false; |
1179 | 1179 | } |
1180 | 1180 | |
@@ -1187,7 +1187,7 @@ discard block |
||
1187 | 1187 | |
1188 | 1188 | imagecopyresampled($process, $this->resource, 0, 0, $x, $y, $w, $h, $w, $h); |
1189 | 1189 | if ($process === false) { |
1190 | - $this->logger->error(__METHOD__ . '(): Error re-sampling process image ' . $w . 'x' . $h, ['app' => 'core']); |
|
1190 | + $this->logger->error(__METHOD__.'(): Error re-sampling process image '.$w.'x'.$h, ['app' => 'core']); |
|
1191 | 1191 | return false; |
1192 | 1192 | } |
1193 | 1193 | return $process; |
@@ -1204,7 +1204,7 @@ discard block |
||
1204 | 1204 | */ |
1205 | 1205 | public function fitIn($maxWidth, $maxHeight) { |
1206 | 1206 | if (!$this->valid()) { |
1207 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
1207 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
1208 | 1208 | return false; |
1209 | 1209 | } |
1210 | 1210 | $widthOrig = imagesx($this->resource); |
@@ -1214,7 +1214,7 @@ discard block |
||
1214 | 1214 | $newWidth = min($maxWidth, $ratio * $maxHeight); |
1215 | 1215 | $newHeight = min($maxHeight, $maxWidth / $ratio); |
1216 | 1216 | |
1217 | - $this->preciseResize((int)round($newWidth), (int)round($newHeight)); |
|
1217 | + $this->preciseResize((int) round($newWidth), (int) round($newHeight)); |
|
1218 | 1218 | return true; |
1219 | 1219 | } |
1220 | 1220 | |
@@ -1227,7 +1227,7 @@ discard block |
||
1227 | 1227 | */ |
1228 | 1228 | public function scaleDownToFit($maxWidth, $maxHeight) { |
1229 | 1229 | if (!$this->valid()) { |
1230 | - $this->logger->error(__METHOD__ . '(): No image loaded', ['app' => 'core']); |
|
1230 | + $this->logger->error(__METHOD__.'(): No image loaded', ['app' => 'core']); |
|
1231 | 1231 | return false; |
1232 | 1232 | } |
1233 | 1233 | $widthOrig = imagesx($this->resource); |
@@ -1323,7 +1323,7 @@ discard block |
||
1323 | 1323 | } elseif ($bit == 32) { |
1324 | 1324 | $bit = 24; |
1325 | 1325 | } |
1326 | - $bits = (int)pow(2, $bit); |
|
1326 | + $bits = (int) pow(2, $bit); |
|
1327 | 1327 | imagetruecolortopalette($im, true, $bits); |
1328 | 1328 | $width = imagesx($im); |
1329 | 1329 | $height = imagesy($im); |
@@ -1332,7 +1332,7 @@ discard block |
||
1332 | 1332 | if ($bit <= 8) { |
1333 | 1333 | for ($i = 0; $i < $colorsNum; $i++) { |
1334 | 1334 | $colors = imagecolorsforindex($im, $i); |
1335 | - $rgbQuad .= chr($colors['blue']) . chr($colors['green']) . chr($colors['red']) . "\0"; |
|
1335 | + $rgbQuad .= chr($colors['blue']).chr($colors['green']).chr($colors['red'])."\0"; |
|
1336 | 1336 | } |
1337 | 1337 | $bmpData = ''; |
1338 | 1338 | if ($compression == 0 || $bit < 8) { |
@@ -1365,7 +1365,7 @@ discard block |
||
1365 | 1365 | $index = imagecolorat($im, $i, $j); |
1366 | 1366 | if ($index !== $lastIndex || $sameNum > 255) { |
1367 | 1367 | if ($sameNum != 0) { |
1368 | - $bmpData .= chr($sameNum) . chr($lastIndex); |
|
1368 | + $bmpData .= chr($sameNum).chr($lastIndex); |
|
1369 | 1369 | } |
1370 | 1370 | $lastIndex = $index; |
1371 | 1371 | $sameNum = 1; |
@@ -1406,15 +1406,15 @@ discard block |
||
1406 | 1406 | $sizeData = strlen($bmpData); |
1407 | 1407 | $colorsNum = 0; |
1408 | 1408 | } |
1409 | - $fileHeader = 'BM' . pack('V3', 54 + $sizeQuad + $sizeData, 0, 54 + $sizeQuad); |
|
1409 | + $fileHeader = 'BM'.pack('V3', 54 + $sizeQuad + $sizeData, 0, 54 + $sizeQuad); |
|
1410 | 1410 | $infoHeader = pack('V3v2V*', 0x28, $width, $height, 1, $bit, $compression, $sizeData, 0, 0, $colorsNum, 0); |
1411 | 1411 | if ($fileName != '') { |
1412 | 1412 | $fp = fopen($fileName, 'wb'); |
1413 | - fwrite($fp, $fileHeader . $infoHeader . $rgbQuad . $bmpData); |
|
1413 | + fwrite($fp, $fileHeader.$infoHeader.$rgbQuad.$bmpData); |
|
1414 | 1414 | fclose($fp); |
1415 | 1415 | return true; |
1416 | 1416 | } |
1417 | - echo $fileHeader . $infoHeader . $rgbQuad . $bmpData; |
|
1417 | + echo $fileHeader.$infoHeader.$rgbQuad.$bmpData; |
|
1418 | 1418 | return true; |
1419 | 1419 | } |
1420 | 1420 | } |