19
19
//$auto_handle_exif_orientation = true;
20
20
21
21
// indicate a source image
22
- $ original_image = $ image ->source_path = 'images/ ' . (!isset ($ _GET ['original ' ]) || !in_array ($ _GET ['original ' ], array ('image-solid.gif ' , 'image-transparent.gif ' , 'image.jpg ' , 'image-solid-png24.png ' , 'image-solid-png8.png ' , 'image-transparent-png24.png ' , 'image-transparent-png8.png ' , 'image-transparent-webp.webp ' )) ? 'image-transparent-png24.png ' : $ _GET ['original ' ]);
22
+ $ original_image = $ image ->source_path = 'images/ ' . (!isset ($ _GET ['original ' ]) || !in_array ($ _GET ['original ' ], array ('image.bmp ' , ' image -solid.gif ' , 'image-transparent.gif ' , 'image.jpg ' , 'image-solid-png24.png ' , 'image-solid-png8.png ' , 'image-transparent-png24.png ' , 'image-transparent-png8.png ' , 'image-transparent-webp.webp ' )) ? 'image-transparent-png24.png ' : $ _GET ['original ' ]);
23
23
24
24
/**
25
25
*
34
34
35
35
// resize
36
36
// and if there is an error, show the error message
37
- if (!$ image ->resize (200 , 200 , ZEBRA_IMAGE_BOXED , -1 )) show_error ($ image ->error , $ image ->source_path , $ image ->target_path );
37
+ if (!$ image ->resize (200 , 200 , ZEBRA_IMAGE_BOXED , stripos ( $ original_image , ' bmp ' ) !== false ? ' #FFFFFF ' : -1 )) show_error ($ image ->error , $ image ->source_path , $ image ->target_path );
38
38
39
39
// from this moment on, work on the resized image
40
40
$ image ->source_path = 'results/resize. ' . $ ext ;
@@ -147,6 +147,7 @@ function show_error($error_code, $source_path, $target_path) {
147
147
<li><a href="?original=image-transparent-png24.png">transparent <strong>PNG24</strong></a></li>
148
148
<li><a href="?original=image-transparent-png8.png">transparent <strong>PNG8</strong></a></li>
149
149
<li><a href="?original=image-transparent-webp.webp">transparent <strong>WEBP</strong></a></li>
150
+ <li><a href="?original=image.bmp"><strong>BMP</strong></a> (really slow)</li>
150
151
</ul>
151
152
<small class="text-right display-block"><em>images have background in order to observe transparency</em></small>
152
153
</th>
@@ -157,7 +158,7 @@ function show_error($error_code, $source_path, $target_path) {
157
158
array (
158
159
'title ' => 'Resizing ' ,
159
160
'image ' => 'resize ' ,
160
- 'usage ' => '$image->resize(200, 200, ZEBRA_IMAGE_BOXED) ' ,
161
+ 'usage ' => '$image->resize(200, 200, ZEBRA_IMAGE_BOXED, -1 ) ' ,
161
162
'docs ' => 'methodresize ' ,
162
163
),
163
164
array (
@@ -196,7 +197,7 @@ function show_error($error_code, $source_path, $target_path) {
196
197
'usage ' => '$image->apply_filter(array( ' . "\n\t" . 'array( \'grayscale \'), ' . "\n\t" . 'array( \'emboss \'), ' . "\n" . ')) ' ,
197
198
'docs ' => 'methodapply_filter ' ,
198
199
),
199
- ) as $ options ): ?>
200
+ ) as $ index => $ options ): ?>
200
201
<tr>
201
202
<th colspan="2">
202
203
<h3><?php echo $ options ['title ' ]; ?> </h3>
@@ -216,7 +217,8 @@ function show_error($error_code, $source_path, $target_path) {
216
217
<?php echo highlight_string ('' .
217
218
'<?php ' .
218
219
"\n\n" . '$image = new Zebra_Image(); ' .
219
- "\n" . '$image->source_path = \'input_image. ' . $ ext . '\'; ' .
220
+ ($ index > 0 ? "\n" . '// source image is the one resized at the beginning ' : '' ) .
221
+ "\n" . '$image->source_path = \'' . ($ index > 0 ? 'resized ' : 'input ' ) . '_image. ' . $ ext . '\'; ' .
220
222
"\n" . '$image->target_path = \'output_image. ' . $ ext . '\'; ' .
221
223
"\n" . 'if (! ' . $ options ['usage ' ] . ') ' .
222
224
"\n\t" . 'die($image->error); ' . "\n\t"
0 commit comments