Completed
Push — master ( dec8bc...81ee9f )
by cam
01:38
created
ecrire/inc/filtres_images_lib_mini.php 1 patch
Spacing   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 	$blue = dechex($blue);
43 43
 
44 44
 	if (strlen($red) == 1) {
45
-		$red = '0' . $red;
45
+		$red = '0'.$red;
46 46
 	}
47 47
 	if (strlen($green) == 1) {
48
-		$green = '0' . $green;
48
+		$green = '0'.$green;
49 49
 	}
50 50
 	if (strlen($blue) == 1) {
51
-		$blue = '0' . $blue;
51
+		$blue = '0'.$blue;
52 52
 	}
53 53
 
54 54
 	return "$red$green$blue";
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 	$couleur = couleur_html_to_hex($couleur);
68 68
 	$couleur = ltrim($couleur, '#');
69 69
 	if (strlen($couleur) === 3) {
70
-		$couleur = $couleur[0] . $couleur[0] . $couleur[1] . $couleur[1] . $couleur[2] . $couleur[2];
70
+		$couleur = $couleur[0].$couleur[0].$couleur[1].$couleur[1].$couleur[2].$couleur[2];
71 71
 	}
72 72
 	$retour = [];
73 73
 	$retour['red'] = hexdec(substr($couleur, 0, 2));
@@ -125,9 +125,9 @@  discard block
 block discarded – undo
125 125
 	$var_G = ($G / 255);
126 126
 	$var_B = ($B / 255);
127 127
 
128
-	$var_Min = min($var_R, $var_G, $var_B);   //Min. value of RGB
129
-	$var_Max = max($var_R, $var_G, $var_B);   //Max. value of RGB
130
-	$del_Max = $var_Max - $var_Min;           //Delta RGB value
128
+	$var_Min = min($var_R, $var_G, $var_B); //Min. value of RGB
129
+	$var_Max = max($var_R, $var_G, $var_B); //Max. value of RGB
130
+	$del_Max = $var_Max - $var_Min; //Delta RGB value
131 131
 
132 132
 	$L = ($var_Max + $var_Min) / 2;
133 133
 
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
  */
190 190
 function _couleur_hsl_to_rgb($H, $S, $L) {
191 191
 	// helper
192
-	$hue_2_rgb = function ($v1, $v2, $vH) {
192
+	$hue_2_rgb = function($v1, $v2, $vH) {
193 193
 		if ($vH < 0) {
194 194
 			$vH += 1;
195 195
 		}
@@ -327,11 +327,11 @@  discard block
 block discarded – undo
327 327
 		}
328 328
 	} elseif (
329 329
 		preg_match('@^data:image/([^;]*);base64,(.*)$@isS', $source, $regs)
330
-		and $extension = _image_trouver_extension_depuis_mime('image/' . $regs[1])
330
+		and $extension = _image_trouver_extension_depuis_mime('image/'.$regs[1])
331 331
 		and in_array($extension, _image_extensions_acceptees_en_entree())
332 332
 	) {
333 333
 		# gerer img src="data:....base64"
334
-		$local = sous_repertoire(_DIR_VAR, 'image-data') . md5($regs[2]) . '.' . _image_extension_normalisee($extension);
334
+		$local = sous_repertoire(_DIR_VAR, 'image-data').md5($regs[2]).'.'._image_extension_normalisee($extension);
335 335
 		if (!file_exists($local)) {
336 336
 			ecrire_fichier($local, base64_decode($regs[2]));
337 337
 		}
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 	// les protocoles web prennent au moins 3 lettres
349 349
 	if (tester_url_absolue($source)) {
350 350
 		include_spip('inc/distant');
351
-		$fichier = _DIR_RACINE . copie_locale($source);
351
+		$fichier = _DIR_RACINE.copie_locale($source);
352 352
 		if (!$fichier) {
353 353
 			return '';
354 354
 		}
@@ -450,9 +450,9 @@  discard block
 block discarded – undo
450 450
 			// on garde la terminaison initiale car image simplement copiee
451 451
 			// et on postfixe son nom avec un md5 du path
452 452
 			$terminaison_dest = $terminaison;
453
-			$fichier_dest .= '-' . substr(md5("$identifiant"), 0, 5);
453
+			$fichier_dest .= '-'.substr(md5("$identifiant"), 0, 5);
454 454
 		} else {
455
-			$fichier_dest .= '-' . substr(md5("$identifiant-$effet"), 0, 5);
455
+			$fichier_dest .= '-'.substr(md5("$identifiant-$effet"), 0, 5);
456 456
 		}
457 457
 		$cache = sous_repertoire(_DIR_VAR, $cache);
458 458
 		$cache = sous_repertoire($cache, $effet);
@@ -463,7 +463,7 @@  discard block
 block discarded – undo
463 463
 		$fichier_dest = substr($fichier_dest, 2);
464 464
 	}
465 465
 
466
-	$fichier_dest = $cache . $fichier_dest . '.' . $terminaison_dest;
466
+	$fichier_dest = $cache.$fichier_dest.'.'.$terminaison_dest;
467 467
 
468 468
 	$GLOBALS['images_calculees'][] = $fichier_dest;
469 469
 
@@ -490,7 +490,7 @@  discard block
 block discarded – undo
490 490
 	if ($creer) {
491 491
 		if (!@file_exists($fichier)) {
492 492
 			if (!@file_exists("$fichier.src")) {
493
-				spip_log("Image absente : $fichier", 'images' . _LOG_ERREUR);
493
+				spip_log("Image absente : $fichier", 'images'._LOG_ERREUR);
494 494
 
495 495
 				return false;
496 496
 			}
@@ -501,15 +501,15 @@  discard block
 block discarded – undo
501 501
 
502 502
 	if ($creer) {
503 503
 		spip_log(
504
-			'filtre image ' . ($fonction_creation ? reset($fonction_creation) : '') . "[$effet] sur $fichier",
505
-			'images' . _LOG_DEBUG
504
+			'filtre image '.($fonction_creation ? reset($fonction_creation) : '')."[$effet] sur $fichier",
505
+			'images'._LOG_DEBUG
506 506
 		);
507 507
 	}
508 508
 
509 509
 	$term_fonction = _image_trouver_extension_pertinente($fichier);
510
-	$ret['fonction_imagecreatefrom'] = '_imagecreatefrom' . $term_fonction;
510
+	$ret['fonction_imagecreatefrom'] = '_imagecreatefrom'.$term_fonction;
511 511
 	$ret['fichier'] = $fichier;
512
-	$ret['fonction_image'] = '_image_image' . $terminaison_dest;
512
+	$ret['fonction_image'] = '_image_image'.$terminaison_dest;
513 513
 	$ret['fichier_dest'] = $fichier_dest;
514 514
 	$ret['format_source'] = _image_extension_normalisee($terminaison);
515 515
 	$ret['format_dest'] = $terminaison_dest;
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 
660 660
 	$_terminaison = _image_trouver_extension_depuis_mime($mime);
661 661
 	if ($_terminaison and $_terminaison !== $terminaison) {
662
-		spip_log("Mauvaise extension du fichier : $path . Son type mime est : $mime", 'images.' . _LOG_INFO_IMPORTANTE);
662
+		spip_log("Mauvaise extension du fichier : $path . Son type mime est : $mime", 'images.'._LOG_INFO_IMPORTANTE);
663 663
 		$terminaison = $_terminaison;
664 664
 	}
665 665
 	return $terminaison;
@@ -816,7 +816,7 @@  discard block
 block discarded – undo
816 816
 	if (!function_exists('imagepng')) {
817 817
 		return false;
818 818
 	}
819
-	$tmp = $fichier . '.tmp';
819
+	$tmp = $fichier.'.tmp';
820 820
 	$ret = imagepng($img, $tmp);
821 821
 	if (file_exists($tmp)) {
822 822
 		$taille_test = @getimagesize($tmp);
@@ -851,7 +851,7 @@  discard block
 block discarded – undo
851 851
 	if (!function_exists('imagegif')) {
852 852
 		return false;
853 853
 	}
854
-	$tmp = $fichier . '.tmp';
854
+	$tmp = $fichier.'.tmp';
855 855
 	$ret = imagegif($img, $tmp);
856 856
 	if (file_exists($tmp)) {
857 857
 		$taille_test = @getimagesize($tmp);
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 	if (!function_exists('imagejpeg')) {
892 892
 		return false;
893 893
 	}
894
-	$tmp = $fichier . '.tmp';
894
+	$tmp = $fichier.'.tmp';
895 895
 
896 896
 	// Enable interlancing
897 897
 	imageinterlace($img, true);
@@ -952,7 +952,7 @@  discard block
 block discarded – undo
952 952
 	if (!function_exists('imagewebp')) {
953 953
 		return false;
954 954
 	}
955
-	$tmp = $fichier . '.tmp';
955
+	$tmp = $fichier.'.tmp';
956 956
 	$ret = imagewebp($img, $tmp, $qualite);
957 957
 	if (file_exists($tmp)) {
958 958
 		$taille_test = @getimagesize($tmp);
@@ -986,7 +986,7 @@  discard block
 block discarded – undo
986 986
  */
987 987
 function _image_imagesvg($img, $fichier) {
988 988
 
989
-	$tmp = $fichier . '.tmp';
989
+	$tmp = $fichier.'.tmp';
990 990
 	if (strpos($img, '<') === false) {
991 991
 		$img = supprimer_timestamp($img);
992 992
 		if (!file_exists($img)) {
@@ -1043,13 +1043,13 @@  discard block
 block discarded – undo
1043 1043
  */
1044 1044
 function _image_gd_output($img, $valeurs, $qualite = _IMG_GD_QUALITE, $fonction = null) {
1045 1045
 	if (is_null($fonction)) {
1046
-		$fonction = '_image_image' . $valeurs['format_dest'];
1046
+		$fonction = '_image_image'.$valeurs['format_dest'];
1047 1047
 	}
1048 1048
 	$ret = false;
1049 1049
 	#un flag pour reperer les images gravees
1050 1050
 	$lock = (
1051 1051
 		!statut_effacer_images_temporaires('get') // si la fonction n'a pas ete activee, on grave tout
1052
-		or (@file_exists($valeurs['fichier_dest']) and !@file_exists($valeurs['fichier_dest'] . '.src'))
1052
+		or (@file_exists($valeurs['fichier_dest']) and !@file_exists($valeurs['fichier_dest'].'.src'))
1053 1053
 	);
1054 1054
 	if (
1055 1055
 		function_exists($fonction)
@@ -1061,7 +1061,7 @@  discard block
 block discarded – undo
1061 1061
 			// dans tous les cas mettre a jour la taille de l'image finale
1062 1062
 			[$valeurs['hauteur_dest'], $valeurs['largeur_dest']] = taille_image($valeurs['fichier_dest']);
1063 1063
 			$valeurs['date'] = @filemtime($valeurs['fichier_dest']); // pour la retrouver apres disparition
1064
-			ecrire_fichier($valeurs['fichier_dest'] . '.src', serialize($valeurs), true);
1064
+			ecrire_fichier($valeurs['fichier_dest'].'.src', serialize($valeurs), true);
1065 1065
 		}
1066 1066
 	}
1067 1067
 
@@ -1240,7 +1240,7 @@  discard block
 block discarded – undo
1240 1240
 
1241 1241
 	// attributs deprecies. Transformer en CSS
1242 1242
 	if ($espace = extraire_attribut($tag, 'hspace')) {
1243
-		$style = "margin:{$espace}px;" . $style;
1243
+		$style = "margin:{$espace}px;".$style;
1244 1244
 		$tag = inserer_attribut($tag, 'hspace', '');
1245 1245
 	}
1246 1246
 
@@ -1367,7 +1367,7 @@  discard block
 block discarded – undo
1367 1367
 	$image = $valeurs['fichier'];
1368 1368
 	$format = $valeurs['format_source'];
1369 1369
 	$destdir = dirname($valeurs['fichier_dest']);
1370
-	$destfile = basename($valeurs['fichier_dest'], '.' . $valeurs['format_dest']);
1370
+	$destfile = basename($valeurs['fichier_dest'], '.'.$valeurs['format_dest']);
1371 1371
 
1372 1372
 	$format_sortie = $valeurs['format_dest'];
1373 1373
 
@@ -1399,7 +1399,7 @@  discard block
 block discarded – undo
1399 1399
 
1400 1400
 	// Si l'image est de la taille demandee (ou plus petite), simplement la retourner
1401 1401
 	if ($srcWidth and $srcWidth <= $maxWidth and $srcHeight <= $maxHeight) {
1402
-		$vignette = $destination . '.' . $format;
1402
+		$vignette = $destination.'.'.$format;
1403 1403
 		@copy($image, $vignette);
1404 1404
 	}
1405 1405
 
@@ -1407,7 +1407,7 @@  discard block
 block discarded – undo
1407 1407
 		include_spip('inc/svg');
1408 1408
 		if ($svg = svg_redimensionner($valeurs['fichier'], $destWidth, $destHeight)) {
1409 1409
 			$format_sortie = 'svg';
1410
-			$vignette = $destination . '.' . $format_sortie;
1410
+			$vignette = $destination.'.'.$format_sortie;
1411 1411
 			$valeurs['fichier_dest'] = $vignette;
1412 1412
 			_image_gd_output($svg, $valeurs);
1413 1413
 		}
@@ -1419,9 +1419,9 @@  discard block
 block discarded – undo
1419 1419
 			define('_CONVERT_COMMAND', 'convert');
1420 1420
 		} // Securite : mes_options.php peut preciser le chemin absolu
1421 1421
 		if (!defined('_RESIZE_COMMAND')) {
1422
-			define('_RESIZE_COMMAND', _CONVERT_COMMAND . ' -quality ' . _IMG_CONVERT_QUALITE . ' -orient Undefined -resize %xx%y! %src %dest');
1422
+			define('_RESIZE_COMMAND', _CONVERT_COMMAND.' -quality '._IMG_CONVERT_QUALITE.' -orient Undefined -resize %xx%y! %src %dest');
1423 1423
 		}
1424
-		$vignette = $destination . '.' . $format_sortie;
1424
+		$vignette = $destination.'.'.$format_sortie;
1425 1425
 		$commande = str_replace(
1426 1426
 			['%x', '%y', '%src', '%dest'],
1427 1427
 			[
@@ -1437,7 +1437,7 @@  discard block
 block discarded – undo
1437 1437
 		if (!@file_exists($vignette)) {
1438 1438
 			spip_log("echec convert sur $vignette");
1439 1439
 
1440
-			return;  // echec commande
1440
+			return; // echec commande
1441 1441
 		}
1442 1442
 	}
1443 1443
 
@@ -1454,7 +1454,7 @@  discard block
 block discarded – undo
1454 1454
 		if (!$output) {
1455 1455
 			return;
1456 1456
 		}
1457
-		$vignette = $output . DIRECTORY_SEPARATOR . basename($destination) . '.' . $format_sortie;
1457
+		$vignette = $output.DIRECTORY_SEPARATOR.basename($destination).'.'.$format_sortie;
1458 1458
 
1459 1459
 		$imagick = new Imagick();
1460 1460
 		$imagick->readImage(realpath($image));
@@ -1463,7 +1463,7 @@  discard block
 block discarded – undo
1463 1463
 			$destHeight,
1464 1464
 			Imagick::FILTER_LANCZOS,
1465 1465
 			1
1466
-		);//, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100);
1466
+		); //, IMAGICK_FILTER_LANCZOS, _IMG_IMAGICK_QUALITE / 100);
1467 1467
 		$imagick->writeImage($vignette);
1468 1468
 
1469 1469
 		if (!@file_exists($vignette)) {
@@ -1472,7 +1472,7 @@  discard block
 block discarded – undo
1472 1472
 			return;
1473 1473
 		}
1474 1474
 		// remettre le chemin relatif car c'est ce qu'attend SPIP pour la suite (en particlier action/tester)
1475
-		$vignette = $destination . '.' . $format_sortie;
1475
+		$vignette = $destination.'.'.$format_sortie;
1476 1476
 	}
1477 1477
 
1478 1478
 	// netpbm
@@ -1483,11 +1483,11 @@  discard block
 block discarded – undo
1483 1483
 		if (_PNMSCALE_COMMAND == '') {
1484 1484
 			return;
1485 1485
 		}
1486
-		$vignette = $destination . '.' . $format_sortie;
1486
+		$vignette = $destination.'.'.$format_sortie;
1487 1487
 		$pnmtojpeg_command = str_replace('pnmscale', 'pnmtojpeg', _PNMSCALE_COMMAND);
1488 1488
 		if ($format == 'jpg') {
1489 1489
 			$jpegtopnm_command = str_replace('pnmscale', 'jpegtopnm', _PNMSCALE_COMMAND);
1490
-			exec("$jpegtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette");
1490
+			exec("$jpegtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette");
1491 1491
 			if (!($s = @filesize($vignette))) {
1492 1492
 				spip_unlink($vignette);
1493 1493
 			}
@@ -1499,7 +1499,7 @@  discard block
 block discarded – undo
1499 1499
 		} else {
1500 1500
 			if ($format == 'gif') {
1501 1501
 				$giftopnm_command = str_replace('pnmscale', 'giftopnm', _PNMSCALE_COMMAND);
1502
-				exec("$giftopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette");
1502
+				exec("$giftopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette");
1503 1503
 				if (!($s = @filesize($vignette))) {
1504 1504
 					spip_unlink($vignette);
1505 1505
 				}
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 			} else {
1512 1512
 				if ($format == 'png') {
1513 1513
 					$pngtopnm_command = str_replace('pnmscale', 'pngtopnm', _PNMSCALE_COMMAND);
1514
-					exec("$pngtopnm_command $image | " . _PNMSCALE_COMMAND . " -width $destWidth | $pnmtojpeg_command > $vignette");
1514
+					exec("$pngtopnm_command $image | "._PNMSCALE_COMMAND." -width $destWidth | $pnmtojpeg_command > $vignette");
1515 1515
 					if (!($s = @filesize($vignette))) {
1516 1516
 						spip_unlink($vignette);
1517 1517
 					}
@@ -1533,7 +1533,7 @@  discard block
 block discarded – undo
1533 1533
 			return;
1534 1534
 		}
1535 1535
 		if (_IMG_GD_MAX_PIXELS && $srcWidth * $srcHeight > _IMG_GD_MAX_PIXELS) {
1536
-			spip_log('vignette gd1/gd2 impossible : ' . $srcWidth * $srcHeight . 'pixels');
1536
+			spip_log('vignette gd1/gd2 impossible : '.$srcWidth * $srcHeight.'pixels');
1537 1537
 
1538 1538
 			return;
1539 1539
 		}
@@ -1843,7 +1843,7 @@  discard block
 block discarded – undo
1843 1843
 		// de l'image, de facon a tromper le cache du navigateur
1844 1844
 		// quand on fait supprimer/reuploader un logo
1845 1845
 		// (pas de filemtime si SAFE MODE)
1846
-		$date = test_espace_prive() ? ('?' . $date) : '';
1846
+		$date = test_espace_prive() ? ('?'.$date) : '';
1847 1847
 
1848 1848
 		return _image_ecrire_tag($image, ['src' => "$logo$date", 'width' => $destWidth, 'height' => $destHeight]);
1849 1849
 	}
@@ -1889,7 +1889,7 @@  discard block
 block discarded – undo
1889 1889
 	public static function LittleEndian2String($number, $minbytes = 1) {
1890 1890
 		$intstring = '';
1891 1891
 		while ($number > 0) {
1892
-			$intstring = $intstring . chr($number & 255);
1892
+			$intstring = $intstring.chr($number & 255);
1893 1893
 			$number >>= 8;
1894 1894
 		}
1895 1895
 
@@ -1921,9 +1921,9 @@  discard block
 block discarded – undo
1921 1921
 					$b = $argb['blue'];
1922 1922
 
1923 1923
 					if ($bpp[$key] == 32) {
1924
-						$icXOR[$key] .= chr($b) . chr($g) . chr($r) . chr($a);
1924
+						$icXOR[$key] .= chr($b).chr($g).chr($r).chr($a);
1925 1925
 					} elseif ($bpp[$key] == 24) {
1926
-						$icXOR[$key] .= chr($b) . chr($g) . chr($r);
1926
+						$icXOR[$key] .= chr($b).chr($g).chr($r);
1927 1927
 					}
1928 1928
 
1929 1929
 					if ($a < 128) {
@@ -1950,48 +1950,48 @@  discard block
 block discarded – undo
1950 1950
 
1951 1951
 			// BITMAPINFOHEADER - 40 bytes
1952 1952
 			$BitmapInfoHeader[$key] = '';
1953
-			$BitmapInfoHeader[$key] .= "\x28\x00\x00\x00";                // DWORD  biSize;
1954
-			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4);    // LONG   biWidth;
1953
+			$BitmapInfoHeader[$key] .= "\x28\x00\x00\x00"; // DWORD  biSize;
1954
+			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageWidths[$key], 4); // LONG   biWidth;
1955 1955
 			// The biHeight member specifies the combined
1956 1956
 			// height of the XOR and AND masks.
1957 1957
 			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($ImageHeights[$key] * 2, 4); // LONG   biHeight;
1958
-			$BitmapInfoHeader[$key] .= "\x01\x00";                    // WORD   biPlanes;
1959
-			$BitmapInfoHeader[$key] .= chr($bpp[$key]) . "\x00";              // wBitCount;
1960
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // DWORD  biCompression;
1961
-			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4);      // DWORD  biSizeImage;
1962
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // LONG   biXPelsPerMeter;
1963
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // LONG   biYPelsPerMeter;
1964
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // DWORD  biClrUsed;
1965
-			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00";                // DWORD  biClrImportant;
1958
+			$BitmapInfoHeader[$key] .= "\x01\x00"; // WORD   biPlanes;
1959
+			$BitmapInfoHeader[$key] .= chr($bpp[$key])."\x00"; // wBitCount;
1960
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD  biCompression;
1961
+			$BitmapInfoHeader[$key] .= phpthumb_functions::LittleEndian2String($biSizeImage, 4); // DWORD  biSizeImage;
1962
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG   biXPelsPerMeter;
1963
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // LONG   biYPelsPerMeter;
1964
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD  biClrUsed;
1965
+			$BitmapInfoHeader[$key] .= "\x00\x00\x00\x00"; // DWORD  biClrImportant;
1966 1966
 		}
1967 1967
 
1968 1968
 
1969
-		$icondata = "\x00\x00";                    // idReserved;   // Reserved (must be 0)
1970
-		$icondata .= "\x01\x00";                    // idType;	   // Resource Type (1 for icons)
1971
-		$icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2);  // idCount;	  // How many images?
1969
+		$icondata = "\x00\x00"; // idReserved;   // Reserved (must be 0)
1970
+		$icondata .= "\x01\x00"; // idType;	   // Resource Type (1 for icons)
1971
+		$icondata .= phpthumb_functions::LittleEndian2String(count($gd_image_array), 2); // idCount;	  // How many images?
1972 1972
 
1973 1973
 		$dwImageOffset = 6 + (count($gd_image_array) * 16);
1974 1974
 		foreach ($gd_image_array as $key => $gd_image) {
1975 1975
 			// ICONDIRENTRY   idEntries[1]; // An entry for each image (idCount of 'em)
1976 1976
 
1977
-			$icondata .= chr($ImageWidths[$key]);           // bWidth;		  // Width, in pixels, of the image
1978
-			$icondata .= chr($ImageHeights[$key]);          // bHeight;		 // Height, in pixels, of the image
1979
-			$icondata .= chr($totalcolors[$key]);           // bColorCount;	 // Number of colors in image (0 if >=8bpp)
1980
-			$icondata .= "\x00";                    // bReserved;	   // Reserved ( must be 0)
1977
+			$icondata .= chr($ImageWidths[$key]); // bWidth;		  // Width, in pixels, of the image
1978
+			$icondata .= chr($ImageHeights[$key]); // bHeight;		 // Height, in pixels, of the image
1979
+			$icondata .= chr($totalcolors[$key]); // bColorCount;	 // Number of colors in image (0 if >=8bpp)
1980
+			$icondata .= "\x00"; // bReserved;	   // Reserved ( must be 0)
1981 1981
 
1982
-			$icondata .= "\x01\x00";                  // wPlanes;		 // Color Planes
1983
-			$icondata .= chr($bpp[$key]) . "\x00";            // wBitCount;	   // Bits per pixel
1982
+			$icondata .= "\x01\x00"; // wPlanes;		 // Color Planes
1983
+			$icondata .= chr($bpp[$key])."\x00"; // wBitCount;	   // Bits per pixel
1984 1984
 
1985 1985
 			$dwBytesInRes = 40 + strlen($icXOR[$key]) + strlen($icAND[$key]);
1986 1986
 			$icondata .= phpthumb_functions::LittleEndian2String(
1987 1987
 				$dwBytesInRes,
1988 1988
 				4
1989
-			);     // dwBytesInRes;	// How many bytes in this resource?
1989
+			); // dwBytesInRes;	// How many bytes in this resource?
1990 1990
 
1991 1991
 			$icondata .= phpthumb_functions::LittleEndian2String(
1992 1992
 				$dwImageOffset,
1993 1993
 				4
1994
-			);    // dwImageOffset;   // Where in the file is this image?
1994
+			); // dwImageOffset;   // Where in the file is this image?
1995 1995
 			$dwImageOffset += strlen($BitmapInfoHeader[$key]);
1996 1996
 			$dwImageOffset += strlen($icXOR[$key]);
1997 1997
 			$dwImageOffset += strlen($icAND[$key]);
Please login to merge, or discard this patch.