Completed
Push — master ( fd6114...816ed5 )
by cam
05:54
created
ecrire/inc/filtres_images_mini.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@
 block discarded – undo
122 122
  * @param int $height_max
123 123
  *    Hauteur minimale de l'image à traiter (10000 par défaut)
124 124
  * @return
125
- *    Le tag html `<img src=... />` avec une class `filtre_inactif` ou pas
125
+ string    Le tag html `<img src=... />` avec une class `filtre_inactif` ou pas
126 126
  */
127 127
 function image_select($img, $width_min = 0, $height_min = 0, $width_max = 10000, $height_max = 1000) {
128 128
 	if (!$img) {
Please login to merge, or discard this patch.
Indentation   +261 added lines, -261 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
  */
19 19
 
20 20
 if (!defined('_ECRIRE_INC_VERSION')) {
21
-	return;
21
+    return;
22 22
 }
23 23
 include_spip('inc/filtres_images_lib_mini'); // par precaution
24 24
 
@@ -31,161 +31,161 @@  discard block
 block discarded – undo
31 31
  *    Le code hexadécimal de la couleur (sans le #) ou le code couleur textuel si non trouvé
32 32
  */
33 33
 function couleur_html_to_hex($couleur) {
34
-	$couleurs_html = array(
35
-		'aliceblue' => 'F0F8FF',
36
-		'antiquewhite' => 'FAEBD7',
37
-		'aqua' => '00FFFF',
38
-		'aquamarine' => '7FFFD4',
39
-		'azure' => 'F0FFFF',
40
-		'beige' => 'F5F5DC',
41
-		'bisque' => 'FFE4C4',
42
-		'black' => '000000',
43
-		'blanchedalmond' => 'FFEBCD',
44
-		'blue' => '0000FF',
45
-		'blueviolet' => '8A2BE2',
46
-		'brown' => 'A52A2A',
47
-		'burlywood' => 'DEB887',
48
-		'cadetblue' => '5F9EA0',
49
-		'chartreuse' => '7FFF00',
50
-		'chocolate' => 'D2691E',
51
-		'coral' => 'FF7F50',
52
-		'cornflowerblue' => '6495ED',
53
-		'cornsilk' => 'FFF8DC',
54
-		'crimson' => 'DC143C',
55
-		'cyan' => '00FFFF',
56
-		'darkblue' => '00008B',
57
-		'darkcyan' => '008B8B',
58
-		'darkgoldenrod' => 'B8860B',
59
-		'darkgray' => 'A9A9A9',
60
-		'darkgreen' => '006400',
61
-		'darkgrey' => 'A9A9A9',
62
-		'darkkhaki' => 'BDB76B',
63
-		'darkmagenta' => '8B008B',
64
-		'darkolivegreen' => '556B2F',
65
-		'darkorange' => 'FF8C00',
66
-		'darkorchid' => '9932CC',
67
-		'darkred' => '8B0000',
68
-		'darksalmon' => 'E9967A',
69
-		'darkseagreen' => '8FBC8F',
70
-		'darkslateblue' => '483D8B',
71
-		'darkslategray' => '2F4F4F',
72
-		'darkslategrey' => '2F4F4F',
73
-		'darkturquoise' => '00CED1',
74
-		'darkviolet' => '9400D3',
75
-		'deeppink' => 'FF1493',
76
-		'deepskyblue' => '00BFFF',
77
-		'dimgray' => '696969',
78
-		'dimgrey' => '696969',
79
-		'dodgerblue' => '1E90FF',
80
-		'firebrick' => 'B22222',
81
-		'floralwhite' => 'FFFAF0',
82
-		'forestgreen' => '228B22',
83
-		'fuchsia' => 'FF00FF',
84
-		'gainsboro' => 'DCDCDC',
85
-		'ghostwhite' => 'F8F8FF',
86
-		'gold' => 'FFD700',
87
-		'goldenrod' => 'DAA520',
88
-		'gray' => '808080',
89
-		'green' => '008000',
90
-		'greenyellow' => 'ADFF2F',
91
-		'grey' => '808080',
92
-		'honeydew' => 'F0FFF0',
93
-		'hotpink' => 'FF69B4',
94
-		'indianred' => 'CD5C5C',
95
-		'indigo' => '4B0082',
96
-		'ivory' => 'FFFFF0',
97
-		'khaki' => 'F0E68C',
98
-		'lavender' => 'E6E6FA',
99
-		'lavenderblush' => 'FFF0F5',
100
-		'lawngreen' => '7CFC00',
101
-		'lemonchiffon' => 'FFFACD',
102
-		'lightblue' => 'ADD8E6',
103
-		'lightcoral' => 'F08080',
104
-		'lightcyan' => 'E0FFFF',
105
-		'lightgoldenrodyellow' => 'FAFAD2',
106
-		'lightgray' => 'D3D3D3',
107
-		'lightgreen' => '90EE90',
108
-		'lightgrey' => 'D3D3D3',
109
-		'lightpink' => 'FFB6C1',
110
-		'lightsalmon' => 'FFA07A',
111
-		'lightseagreen' => '20B2AA',
112
-		'lightskyblue' => '87CEFA',
113
-		'lightslategray' => '778899',
114
-		'lightslategrey' => '778899',
115
-		'lightsteelblue' => 'B0C4DE',
116
-		'lightyellow' => 'FFFFE0',
117
-		'lime' => '00FF00',
118
-		'limegreen' => '32CD32',
119
-		'linen' => 'FAF0E6',
120
-		'magenta' => 'FF00FF',
121
-		'maroon' => '800000',
122
-		'mediumaquamarine' => '66CDAA',
123
-		'mediumblue' => '0000CD',
124
-		'mediumorchid' => 'BA55D3',
125
-		'mediumpurple' => '9370DB',
126
-		'mediumseagreen' => '3CB371',
127
-		'mediumslateblue' => '7B68EE',
128
-		'mediumspringgreen' => '00FA9A',
129
-		'mediumturquoise' => '48D1CC',
130
-		'mediumvioletred' => 'C71585',
131
-		'midnightblue' => '191970',
132
-		'mintcream' => 'F5FFFA',
133
-		'mistyrose' => 'FFE4E1',
134
-		'moccasin' => 'FFE4B5',
135
-		'navajowhite' => 'FFDEAD',
136
-		'navy' => '000080',
137
-		'oldlace' => 'FDF5E6',
138
-		'olive' => '808000',
139
-		'olivedrab' => '6B8E23',
140
-		'orange' => 'FFA500',
141
-		'orangered' => 'FF4500',
142
-		'orchid' => 'DA70D6',
143
-		'palegoldenrod' => 'EEE8AA',
144
-		'palegreen' => '98FB98',
145
-		'paleturquoise' => 'AFEEEE',
146
-		'palevioletred' => 'DB7093',
147
-		'papayawhip' => 'FFEFD5',
148
-		'peachpuff' => 'FFDAB9',
149
-		'peru' => 'CD853F',
150
-		'pink' => 'FFC0CB',
151
-		'plum' => 'DDA0DD',
152
-		'powderblue' => 'B0E0E6',
153
-		'purple' => '800080',
154
-		'rebeccapurple' => '663399',
155
-		'red' => 'FF0000',
156
-		'rosybrown' => 'BC8F8F',
157
-		'royalblue' => '4169E1',
158
-		'saddlebrown' => '8B4513',
159
-		'salmon' => 'FA8072',
160
-		'sandybrown' => 'F4A460',
161
-		'seagreen' => '2E8B57',
162
-		'seashell' => 'FFF5EE',
163
-		'sienna' => 'A0522D',
164
-		'silver' => 'C0C0C0',
165
-		'skyblue' => '87CEEB',
166
-		'slateblue' => '6A5ACD',
167
-		'slategray' => '708090',
168
-		'slategrey' => '708090',
169
-		'snow' => 'FFFAFA',
170
-		'springgreen' => '00FF7F',
171
-		'steelblue' => '4682B4',
172
-		'tan' => 'D2B48C',
173
-		'teal' => '008080',
174
-		'thistle' => 'D8BFD8',
175
-		'tomato' => 'FF6347',
176
-		'turquoise' => '40E0D0',
177
-		'violet' => 'EE82EE',
178
-		'wheat' => 'F5DEB3',
179
-		'white' => 'FFFFFF',
180
-		'whitesmoke' => 'F5F5F5',
181
-		'yellow' => 'FFFF00',
182
-		'yellowgreen' => '9ACD32',
183
-	);
184
-	if (isset($couleurs_html[$lc = strtolower($couleur)])) {
185
-		return $couleurs_html[$lc];
186
-	}
187
-
188
-	return $couleur;
34
+    $couleurs_html = array(
35
+        'aliceblue' => 'F0F8FF',
36
+        'antiquewhite' => 'FAEBD7',
37
+        'aqua' => '00FFFF',
38
+        'aquamarine' => '7FFFD4',
39
+        'azure' => 'F0FFFF',
40
+        'beige' => 'F5F5DC',
41
+        'bisque' => 'FFE4C4',
42
+        'black' => '000000',
43
+        'blanchedalmond' => 'FFEBCD',
44
+        'blue' => '0000FF',
45
+        'blueviolet' => '8A2BE2',
46
+        'brown' => 'A52A2A',
47
+        'burlywood' => 'DEB887',
48
+        'cadetblue' => '5F9EA0',
49
+        'chartreuse' => '7FFF00',
50
+        'chocolate' => 'D2691E',
51
+        'coral' => 'FF7F50',
52
+        'cornflowerblue' => '6495ED',
53
+        'cornsilk' => 'FFF8DC',
54
+        'crimson' => 'DC143C',
55
+        'cyan' => '00FFFF',
56
+        'darkblue' => '00008B',
57
+        'darkcyan' => '008B8B',
58
+        'darkgoldenrod' => 'B8860B',
59
+        'darkgray' => 'A9A9A9',
60
+        'darkgreen' => '006400',
61
+        'darkgrey' => 'A9A9A9',
62
+        'darkkhaki' => 'BDB76B',
63
+        'darkmagenta' => '8B008B',
64
+        'darkolivegreen' => '556B2F',
65
+        'darkorange' => 'FF8C00',
66
+        'darkorchid' => '9932CC',
67
+        'darkred' => '8B0000',
68
+        'darksalmon' => 'E9967A',
69
+        'darkseagreen' => '8FBC8F',
70
+        'darkslateblue' => '483D8B',
71
+        'darkslategray' => '2F4F4F',
72
+        'darkslategrey' => '2F4F4F',
73
+        'darkturquoise' => '00CED1',
74
+        'darkviolet' => '9400D3',
75
+        'deeppink' => 'FF1493',
76
+        'deepskyblue' => '00BFFF',
77
+        'dimgray' => '696969',
78
+        'dimgrey' => '696969',
79
+        'dodgerblue' => '1E90FF',
80
+        'firebrick' => 'B22222',
81
+        'floralwhite' => 'FFFAF0',
82
+        'forestgreen' => '228B22',
83
+        'fuchsia' => 'FF00FF',
84
+        'gainsboro' => 'DCDCDC',
85
+        'ghostwhite' => 'F8F8FF',
86
+        'gold' => 'FFD700',
87
+        'goldenrod' => 'DAA520',
88
+        'gray' => '808080',
89
+        'green' => '008000',
90
+        'greenyellow' => 'ADFF2F',
91
+        'grey' => '808080',
92
+        'honeydew' => 'F0FFF0',
93
+        'hotpink' => 'FF69B4',
94
+        'indianred' => 'CD5C5C',
95
+        'indigo' => '4B0082',
96
+        'ivory' => 'FFFFF0',
97
+        'khaki' => 'F0E68C',
98
+        'lavender' => 'E6E6FA',
99
+        'lavenderblush' => 'FFF0F5',
100
+        'lawngreen' => '7CFC00',
101
+        'lemonchiffon' => 'FFFACD',
102
+        'lightblue' => 'ADD8E6',
103
+        'lightcoral' => 'F08080',
104
+        'lightcyan' => 'E0FFFF',
105
+        'lightgoldenrodyellow' => 'FAFAD2',
106
+        'lightgray' => 'D3D3D3',
107
+        'lightgreen' => '90EE90',
108
+        'lightgrey' => 'D3D3D3',
109
+        'lightpink' => 'FFB6C1',
110
+        'lightsalmon' => 'FFA07A',
111
+        'lightseagreen' => '20B2AA',
112
+        'lightskyblue' => '87CEFA',
113
+        'lightslategray' => '778899',
114
+        'lightslategrey' => '778899',
115
+        'lightsteelblue' => 'B0C4DE',
116
+        'lightyellow' => 'FFFFE0',
117
+        'lime' => '00FF00',
118
+        'limegreen' => '32CD32',
119
+        'linen' => 'FAF0E6',
120
+        'magenta' => 'FF00FF',
121
+        'maroon' => '800000',
122
+        'mediumaquamarine' => '66CDAA',
123
+        'mediumblue' => '0000CD',
124
+        'mediumorchid' => 'BA55D3',
125
+        'mediumpurple' => '9370DB',
126
+        'mediumseagreen' => '3CB371',
127
+        'mediumslateblue' => '7B68EE',
128
+        'mediumspringgreen' => '00FA9A',
129
+        'mediumturquoise' => '48D1CC',
130
+        'mediumvioletred' => 'C71585',
131
+        'midnightblue' => '191970',
132
+        'mintcream' => 'F5FFFA',
133
+        'mistyrose' => 'FFE4E1',
134
+        'moccasin' => 'FFE4B5',
135
+        'navajowhite' => 'FFDEAD',
136
+        'navy' => '000080',
137
+        'oldlace' => 'FDF5E6',
138
+        'olive' => '808000',
139
+        'olivedrab' => '6B8E23',
140
+        'orange' => 'FFA500',
141
+        'orangered' => 'FF4500',
142
+        'orchid' => 'DA70D6',
143
+        'palegoldenrod' => 'EEE8AA',
144
+        'palegreen' => '98FB98',
145
+        'paleturquoise' => 'AFEEEE',
146
+        'palevioletred' => 'DB7093',
147
+        'papayawhip' => 'FFEFD5',
148
+        'peachpuff' => 'FFDAB9',
149
+        'peru' => 'CD853F',
150
+        'pink' => 'FFC0CB',
151
+        'plum' => 'DDA0DD',
152
+        'powderblue' => 'B0E0E6',
153
+        'purple' => '800080',
154
+        'rebeccapurple' => '663399',
155
+        'red' => 'FF0000',
156
+        'rosybrown' => 'BC8F8F',
157
+        'royalblue' => '4169E1',
158
+        'saddlebrown' => '8B4513',
159
+        'salmon' => 'FA8072',
160
+        'sandybrown' => 'F4A460',
161
+        'seagreen' => '2E8B57',
162
+        'seashell' => 'FFF5EE',
163
+        'sienna' => 'A0522D',
164
+        'silver' => 'C0C0C0',
165
+        'skyblue' => '87CEEB',
166
+        'slateblue' => '6A5ACD',
167
+        'slategray' => '708090',
168
+        'slategrey' => '708090',
169
+        'snow' => 'FFFAFA',
170
+        'springgreen' => '00FF7F',
171
+        'steelblue' => '4682B4',
172
+        'tan' => 'D2B48C',
173
+        'teal' => '008080',
174
+        'thistle' => 'D8BFD8',
175
+        'tomato' => 'FF6347',
176
+        'turquoise' => '40E0D0',
177
+        'violet' => 'EE82EE',
178
+        'wheat' => 'F5DEB3',
179
+        'white' => 'FFFFFF',
180
+        'whitesmoke' => 'F5F5F5',
181
+        'yellow' => 'FFFF00',
182
+        'yellowgreen' => '9ACD32',
183
+    );
184
+    if (isset($couleurs_html[$lc = strtolower($couleur)])) {
185
+        return $couleurs_html[$lc];
186
+    }
187
+
188
+    return $couleur;
189 189
 }
190 190
 
191 191
 /**
@@ -201,15 +201,15 @@  discard block
 block discarded – undo
201 201
  *    Code hexadécimal de la couleur plus foncée
202 202
  */
203 203
 function couleur_foncer($couleur, $coeff = 0.5) {
204
-	$couleurs = _couleur_hex_to_dec($couleur);
204
+    $couleurs = _couleur_hex_to_dec($couleur);
205 205
 
206
-	$red = $couleurs['red'] - round(($couleurs['red']) * $coeff);
207
-	$green = $couleurs['green'] - round(($couleurs['green']) * $coeff);
208
-	$blue = $couleurs['blue'] - round(($couleurs['blue']) * $coeff);
206
+    $red = $couleurs['red'] - round(($couleurs['red']) * $coeff);
207
+    $green = $couleurs['green'] - round(($couleurs['green']) * $coeff);
208
+    $blue = $couleurs['blue'] - round(($couleurs['blue']) * $coeff);
209 209
 
210
-	$couleur = _couleur_dec_to_hex($red, $green, $blue);
210
+    $couleur = _couleur_dec_to_hex($red, $green, $blue);
211 211
 
212
-	return $couleur;
212
+    return $couleur;
213 213
 }
214 214
 
215 215
 /**
@@ -225,15 +225,15 @@  discard block
 block discarded – undo
225 225
  *    Code hexadécimal de la couleur éclaircie
226 226
  */
227 227
 function couleur_eclaircir($couleur, $coeff = 0.5) {
228
-	$couleurs = _couleur_hex_to_dec($couleur);
228
+    $couleurs = _couleur_hex_to_dec($couleur);
229 229
 
230
-	$red = $couleurs['red'] + round((255 - $couleurs['red']) * $coeff);
231
-	$green = $couleurs['green'] + round((255 - $couleurs['green']) * $coeff);
232
-	$blue = $couleurs['blue'] + round((255 - $couleurs['blue']) * $coeff);
230
+    $red = $couleurs['red'] + round((255 - $couleurs['red']) * $coeff);
231
+    $green = $couleurs['green'] + round((255 - $couleurs['green']) * $coeff);
232
+    $blue = $couleurs['blue'] + round((255 - $couleurs['blue']) * $coeff);
233 233
 
234
-	$couleur = _couleur_dec_to_hex($red, $green, $blue);
234
+    $couleur = _couleur_dec_to_hex($red, $green, $blue);
235 235
 
236
-	return $couleur;
236
+    return $couleur;
237 237
 }
238 238
 
239 239
 /**
@@ -256,28 +256,28 @@  discard block
 block discarded – undo
256 256
  *    Le tag html `<img src=... />` avec une class `filtre_inactif` ou pas
257 257
  */
258 258
 function image_select($img, $width_min = 0, $height_min = 0, $width_max = 10000, $height_max = 1000) {
259
-	if (!$img) {
260
-		return $img;
261
-	}
262
-	list($h, $l) = taille_image($img);
263
-	$select = true;
264
-	if ($l < $width_min or $l > $width_max or $h < $height_min or $h > $height_max) {
265
-		$select = false;
266
-	}
267
-
268
-	$class = extraire_attribut($img, 'class');
269
-	$p = strpos($class, 'filtre_inactif');
270
-	if (($select == false) and ($p === false)) {
271
-		$class .= ' filtre_inactif';
272
-		$img = inserer_attribut($img, 'class', $class);
273
-	}
274
-	if (($select == true) and ($p !== false)) {
275
-		// no_image_filtrer : historique, a virer
276
-		$class = preg_replace(',\s*(filtre_inactif|no_image_filtrer),', '', $class);
277
-		$img = inserer_attribut($img, 'class', $class);
278
-	}
279
-
280
-	return $img;
259
+    if (!$img) {
260
+        return $img;
261
+    }
262
+    list($h, $l) = taille_image($img);
263
+    $select = true;
264
+    if ($l < $width_min or $l > $width_max or $h < $height_min or $h > $height_max) {
265
+        $select = false;
266
+    }
267
+
268
+    $class = extraire_attribut($img, 'class');
269
+    $p = strpos($class, 'filtre_inactif');
270
+    if (($select == false) and ($p === false)) {
271
+        $class .= ' filtre_inactif';
272
+        $img = inserer_attribut($img, 'class', $class);
273
+    }
274
+    if (($select == true) and ($p !== false)) {
275
+        // no_image_filtrer : historique, a virer
276
+        $class = preg_replace(',\s*(filtre_inactif|no_image_filtrer),', '', $class);
277
+        $img = inserer_attribut($img, 'class', $class);
278
+    }
279
+
280
+    return $img;
281 281
 }
282 282
 
283 283
 /**
@@ -325,38 +325,38 @@  discard block
 block discarded – undo
325 325
  *     Code HTML de l'image ou du texte.
326 326
  **/
327 327
 function image_passe_partout(
328
-	$img,
329
-	$taille_x = -1,
330
-	$taille_y = -1,
331
-	$force = false,
332
-	$cherche_image = false,
333
-	$process = 'AUTO'
328
+    $img,
329
+    $taille_x = -1,
330
+    $taille_y = -1,
331
+    $force = false,
332
+    $cherche_image = false,
333
+    $process = 'AUTO'
334 334
 ) {
335
-	if (!$img) {
336
-		return '';
337
-	}
338
-	list($hauteur, $largeur) = taille_image($img);
339
-	if ($taille_x == -1) {
340
-		$taille_x = isset($GLOBALS['meta']['taille_preview']) ? $GLOBALS['meta']['taille_preview'] : 150;
341
-	}
342
-	if ($taille_y == -1) {
343
-		$taille_y = $taille_x;
344
-	}
345
-
346
-	if ($taille_x == 0 and $taille_y > 0) {
347
-		$taille_x = 1;
348
-	} # {0,300} -> c'est 300 qui compte
349
-	elseif ($taille_x > 0 and $taille_y == 0) {
350
-		$taille_y = 1;
351
-	} # {300,0} -> c'est 300 qui compte
352
-	elseif ($taille_x == 0 and $taille_y == 0) {
353
-		return '';
354
-	}
355
-
356
-	list($destWidth, $destHeight, $ratio) = ratio_passe_partout($largeur, $hauteur, $taille_x, $taille_y);
357
-	$fonction = array('image_passe_partout', func_get_args());
358
-
359
-	return process_image_reduire($fonction, $img, $destWidth, $destHeight, $force, $process);
335
+    if (!$img) {
336
+        return '';
337
+    }
338
+    list($hauteur, $largeur) = taille_image($img);
339
+    if ($taille_x == -1) {
340
+        $taille_x = isset($GLOBALS['meta']['taille_preview']) ? $GLOBALS['meta']['taille_preview'] : 150;
341
+    }
342
+    if ($taille_y == -1) {
343
+        $taille_y = $taille_x;
344
+    }
345
+
346
+    if ($taille_x == 0 and $taille_y > 0) {
347
+        $taille_x = 1;
348
+    } # {0,300} -> c'est 300 qui compte
349
+    elseif ($taille_x > 0 and $taille_y == 0) {
350
+        $taille_y = 1;
351
+    } # {300,0} -> c'est 300 qui compte
352
+    elseif ($taille_x == 0 and $taille_y == 0) {
353
+        return '';
354
+    }
355
+
356
+    list($destWidth, $destHeight, $ratio) = ratio_passe_partout($largeur, $hauteur, $taille_x, $taille_y);
357
+    $fonction = array('image_passe_partout', func_get_args());
358
+
359
+    return process_image_reduire($fonction, $img, $destWidth, $destHeight, $force, $process);
360 360
 }
361 361
 
362 362
 /**
@@ -399,28 +399,28 @@  discard block
 block discarded – undo
399 399
  *     Code HTML de l'image ou du texte.
400 400
  **/
401 401
 function image_reduire($img, $taille = -1, $taille_y = -1, $force = false, $cherche_image = false, $process = 'AUTO') {
402
-	// Determiner la taille x,y maxi
403
-	// prendre le reglage de previsu par defaut
404
-	if ($taille == -1) {
405
-		$taille = (isset($GLOBALS['meta']['taille_preview']) and intval($GLOBALS['meta']['taille_preview'])) ? intval($GLOBALS['meta']['taille_preview']) : 150;
406
-	}
407
-	if ($taille_y == -1) {
408
-		$taille_y = $taille;
409
-	}
410
-
411
-	if ($taille == 0 and $taille_y > 0) {
412
-		$taille = 10000;
413
-	} # {0,300} -> c'est 300 qui compte
414
-	elseif ($taille > 0 and $taille_y == 0) {
415
-		$taille_y = 10000;
416
-	} # {300,0} -> c'est 300 qui compte
417
-	elseif ($taille == 0 and $taille_y == 0) {
418
-		return '';
419
-	}
420
-
421
-	$fonction = array('image_reduire', func_get_args());
422
-
423
-	return process_image_reduire($fonction, $img, $taille, $taille_y, $force, $process);
402
+    // Determiner la taille x,y maxi
403
+    // prendre le reglage de previsu par defaut
404
+    if ($taille == -1) {
405
+        $taille = (isset($GLOBALS['meta']['taille_preview']) and intval($GLOBALS['meta']['taille_preview'])) ? intval($GLOBALS['meta']['taille_preview']) : 150;
406
+    }
407
+    if ($taille_y == -1) {
408
+        $taille_y = $taille;
409
+    }
410
+
411
+    if ($taille == 0 and $taille_y > 0) {
412
+        $taille = 10000;
413
+    } # {0,300} -> c'est 300 qui compte
414
+    elseif ($taille > 0 and $taille_y == 0) {
415
+        $taille_y = 10000;
416
+    } # {300,0} -> c'est 300 qui compte
417
+    elseif ($taille == 0 and $taille_y == 0) {
418
+        return '';
419
+    }
420
+
421
+    $fonction = array('image_reduire', func_get_args());
422
+
423
+    return process_image_reduire($fonction, $img, $taille, $taille_y, $force, $process);
424 424
 }
425 425
 
426 426
 
@@ -439,20 +439,20 @@  discard block
 block discarded – undo
439 439
  *     Code HTML de l'image ou du texte.
440 440
  **/
441 441
 function image_reduire_par($img, $val = 1, $force = false) {
442
-	list($hauteur, $largeur) = taille_image($img);
442
+    list($hauteur, $largeur) = taille_image($img);
443 443
 
444
-	$l = round($largeur / $val);
445
-	$h = round($hauteur / $val);
444
+    $l = round($largeur / $val);
445
+    $h = round($hauteur / $val);
446 446
 
447
-	if ($l > $h) {
448
-		$h = 0;
449
-	} else {
450
-		$l = 0;
451
-	}
447
+    if ($l > $h) {
448
+        $h = 0;
449
+    } else {
450
+        $l = 0;
451
+    }
452 452
 
453
-	$img = image_reduire($img, $l, $h, $force);
453
+    $img = image_reduire($img, $l, $h, $force);
454 454
 
455
-	return $img;
455
+    return $img;
456 456
 }
457 457
 
458 458
 /**
@@ -475,10 +475,10 @@  discard block
 block discarded – undo
475 475
  *      Couleur en écriture hexadécimale.
476 476
 **/
477 477
 function filtre_couleur_saturation_dist($couleur, $val, $strict = false) {
478
-	if (function_exists('couleur_saturation')) {
479
-		return couleur_saturation($couleur, $val, $strict);
480
-	}
481
-	return $couleur;
478
+    if (function_exists('couleur_saturation')) {
479
+        return couleur_saturation($couleur, $val, $strict);
480
+    }
481
+    return $couleur;
482 482
 }
483 483
 
484 484
 /**
@@ -499,8 +499,8 @@  discard block
 block discarded – undo
499 499
  *      Couleur en écriture hexadécimale.
500 500
 **/
501 501
 function filtre_couleur_luminance_dist($couleur, $val) {
502
-	if (function_exists('couleur_luminance')) {
503
-		return couleur_luminance($couleur, $val);
504
-	}
505
-	return $couleur;
502
+    if (function_exists('couleur_luminance')) {
503
+        return couleur_luminance($couleur, $val);
504
+    }
505
+    return $couleur;
506 506
 }
Please login to merge, or discard this patch.