From 0799fc234218fccc613ec0246da3700a076db50c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Ra=C3=B1a?= Date: Wed, 4 Jul 2012 00:28:07 +0200 Subject: [PATCH] document slideshow automatic image resize --- main/document/slideshow.inc.php | 2 +- main/document/slideshow.php | 62 ++++++++++++++++++++++++++++-- main/document/slideshowoptions.php | 19 ++++++++- 3 files changed, 78 insertions(+), 5 deletions(-) mode change 100755 => 100644 main/document/slideshow.inc.php diff --git a/main/document/slideshow.inc.php b/main/document/slideshow.inc.php old mode 100755 new mode 100644 index 708ac4b87b..bababc9acc --- a/main/document/slideshow.inc.php +++ b/main/document/slideshow.inc.php @@ -40,7 +40,7 @@ function resize_image($image, $target_width, $target_height, $slideshow = 0) { $new_sizes = api_resize_image($image, $target_width, $target_height); $result[] = $new_sizes['height']; $result[] = $new_sizes['width']; - } else { + } else { $size = api_getimagesize($image); $result[] = $size['height']; $result[] = $size['width']; diff --git a/main/document/slideshow.php b/main/document/slideshow.php index ca537c93ef..453ec23a9c 100644 --- a/main/document/slideshow.php +++ b/main/document/slideshow.php @@ -151,7 +151,11 @@ echo '
'; // If we come from slideshowoptions.php we sessionize (new word !!! ;-) the options if (isset($_POST['Submit'])) { // We come from slideshowoptions.php + + //$_SESSION["auto_image_resizing"]=Security::remove_XSS($_POST['auto_radio_resizing']); + $_SESSION["image_resizing"] = Security::remove_XSS($_POST['radio_resizing']); + if ($_POST['radio_resizing'] == "resizing" && $_POST['width'] != '' && $_POST['height'] != '') { //echo "resizing"; $_SESSION["image_resizing_width"] = Security::remove_XSS($_POST['width']); @@ -227,6 +231,7 @@ if ($slide_id != 'all') { $image_height = $image_height_width[0]; $image_width = $image_height_width[1]; + $height_width_tags = null; if (isset($_SESSION['image_resizing']) && $_SESSION['image_resizing'] == 'resizing') { $height_width_tags = 'width="'.$image_width.'" height="'.$image_height.'"'; @@ -260,7 +265,59 @@ if ($slide_id != 'all') { if ($path == '/') { $path = ''; } - echo "".$image_files_only[$slide].""; + + list($width, $height) = getimagesize($image); + + //auto resize + if($_SESSION["image_resizing"]!="noresizing" && $_SESSION["image_resizing"]!="resizing" ){ + ?> + + + + "; + } + echo ''; echo ''; echo ''; @@ -279,8 +336,7 @@ if ($slide_id != 'all') { $aux = explode('.', htmlspecialchars($image_files_only[$slide])); $ext = $aux[count($aux) - 1]; echo $image_files_only[$slide].'
'; - list($width, $high) = getimagesize($image); - echo $width.' x '.$high.'
'; + echo $width.' x '.$height.'
'; echo round((filesize($image)/1024), 2).' KB'; echo ' - '.$ext; echo ''; diff --git a/main/document/slideshowoptions.php b/main/document/slideshowoptions.php index 26871a1a71..df1349aa27 100644 --- a/main/document/slideshowoptions.php +++ b/main/document/slideshowoptions.php @@ -109,7 +109,24 @@ echo '';
- + + + +
+
+ > + + +
+
+
+
+ +