Skip to content

Commit 05448a0

Browse files
committed
Updated examples, added BMP
1 parent 6774cce commit 05448a0

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

examples/images/image.bmp

40.5 KB
Binary file not shown.

examples/index.php

+7-5
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//$auto_handle_exif_orientation = true;
2020

2121
// 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']);
2323

2424
/**
2525
*
@@ -34,7 +34,7 @@
3434

3535
// resize
3636
// 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);
3838

3939
// from this moment on, work on the resized image
4040
$image->source_path = 'results/resize.' . $ext;
@@ -147,6 +147,7 @@ function show_error($error_code, $source_path, $target_path) {
147147
<li><a href="?original=image-transparent-png24.png">transparent <strong>PNG24</strong></a></li>
148148
<li><a href="?original=image-transparent-png8.png">transparent <strong>PNG8</strong></a></li>
149149
<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>
150151
</ul>
151152
<small class="text-right display-block"><em>images have background in order to observe transparency</em></small>
152153
</th>
@@ -157,7 +158,7 @@ function show_error($error_code, $source_path, $target_path) {
157158
array(
158159
'title' => 'Resizing',
159160
'image' => 'resize',
160-
'usage' => '$image->resize(200, 200, ZEBRA_IMAGE_BOXED)',
161+
'usage' => '$image->resize(200, 200, ZEBRA_IMAGE_BOXED, -1)',
161162
'docs' => 'methodresize',
162163
),
163164
array(
@@ -196,7 +197,7 @@ function show_error($error_code, $source_path, $target_path) {
196197
'usage' => '$image->apply_filter(array(' . "\n\t" . 'array(\'grayscale\'),' . "\n\t" . 'array(\'emboss\'),' . "\n" . '))',
197198
'docs' => 'methodapply_filter',
198199
),
199-
) as $options): ?>
200+
) as $index => $options): ?>
200201
<tr>
201202
<th colspan="2">
202203
<h3><?php echo $options['title']; ?></h3>
@@ -216,7 +217,8 @@ function show_error($error_code, $source_path, $target_path) {
216217
<?php echo highlight_string('' .
217218
'<?php ' .
218219
"\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 . '\';' .
220222
"\n" . '$image->target_path = \'output_image.' . $ext . '\';' .
221223
"\n" . 'if (!' . $options['usage'] . ')' .
222224
"\n\t" . 'die($image->error);' . "\n\t"

0 commit comments

Comments
 (0)