diff options
| author | pp <pp@455248ca-bdda-0310-9134-f4ebb693071a> | 2004-05-19 04:59:31 +0000 |
|---|---|---|
| committer | pp <pp@455248ca-bdda-0310-9134-f4ebb693071a> | 2004-05-19 04:59:31 +0000 |
| commit | d0a9b9a03fc7ae74ef8a64593ac6b592526ec4d5 (patch) | |
| tree | e03d2a7fac8c7619f1286545f717ef7ee3866cd6 /examples/scale.php | |
- initial import
git-svn-id: https://siedziba.pl:790/svn/repos/php-imlib/trunk@7 455248ca-bdda-0310-9134-f4ebb693071a
Diffstat (limited to 'examples/scale.php')
| -rw-r--r-- | examples/scale.php | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/examples/scale.php b/examples/scale.php new file mode 100644 index 0000000..33be4c9 --- /dev/null +++ b/examples/scale.php @@ -0,0 +1,30 @@ +<?php + +if (!isset($file) || $file == 'none') +{ + ?> + <form method="post" action="<?= $PHP_SELF ?>" enctype="multipart/form-data"> + Filename<br><input type="file" name="file"><br> + <input type="submit" name="Scale"> + </form> + <?php +} +else +{ + $src = imlib_load_image($file); + $width = imlib_image_get_width($src); + $height = imlib_image_get_height($src); + $ratio = $height / $width; + $dst = imlib_create_cropped_scaled_image($src, 0,0, $width,$height, + 200, 200 * $ratio); + + // Alternatively, you could simply say + //$dst = imlib_create_scaled_image($src, 200, ''); + + Header('Content-type: image/' . imlib_image_format($src)); + imlib_dump_image($dst); + imlib_free_image($src); + imlib_free_image($dst); +} + +?> |
