123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- <?php
- function resize_image($image, $target_width, $target_height, $slideshow=0)
- {
-
- $image_properties=getimagesize($image);
- $source_width=$image_properties["0"];
- $source_height=$image_properties["1"];
-
-
- if ($_SESSION["image_resizing"]=="resizing" or $slideshow==1)
- {
- $resize_factor_width=$target_width/$source_width;
- $resize_factor_height=$target_height/$source_height;
-
- }
-
- if ($_SESSION["image_resizing"]=="resizing" or $slideshow==1)
- {
- if ($resize_factor_width<=1 and $resize_factor_height<=1)
- {
- if ($resize_factor_width > $resize_factor_height)
- {
- $image_width=$target_width;
- $image_height=ceil($source_height*$resize_factor_width);
- }
- if ($resize_factor_width < $resize_factor_height)
- {
- $image_width=ceil($source_width*$resize_factor_height);
- $image_height=$target_height;
- }
- else
- {
- $image_width=ceil($source_width*$resize_factor_width);
- $image_height=ceil($source_height*$resize_factor_height);
- }
-
-
- }
- else
- {
- $image_width=$source_width;
- $image_height=$source_height;
- }
- }
- $image_height_width[]=$image_height;
- $image_height_width[]=$image_width;
- return $image_height_width;
- }
- ?>
|