From f1888b4467ce2d64c96a86640db7aae9883ea1b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Ra=C3=B1a?= Date: Mon, 16 Jul 2012 21:31:30 +0200 Subject: [PATCH] Feature #5142 adding support for small images --- main/document/slideshow.php | 23 ++++++++++++------- .../_ajax_get_thumbnail_listing.php | 7 +++--- 2 files changed, 19 insertions(+), 11 deletions(-) diff --git a/main/document/slideshow.php b/main/document/slideshow.php index 37605685b1..8cd98aaaf3 100644 --- a/main/document/slideshow.php +++ b/main/document/slideshow.php @@ -229,12 +229,11 @@ if ($slide_id == 'all') { //check thumbnail $imagetype = explode(".", $image); $imagetype = strtolower($imagetype[count($imagetype)-1]);//or check $imagetype = image_type_to_extension(exif_imagetype($image), false); + $original_image_size = api_getimagesize($image); - if(in_array($imagetype,$allowed_thumbnail_types)) { + if(in_array($imagetype,$allowed_thumbnail_types) && $original_image_size['width']>$max_thumbnail_width || $original_image_size['height']>$max_thumbnail_height) { - if (!file_exists($image_thumbnail)){ - - $original_image_size = api_getimagesize($image); + if (!file_exists($image_thumbnail)){ switch($imagetype) { case 'gif': $source_img = imagecreatefromgif($image); @@ -300,11 +299,19 @@ if ($slide_id == 'all') { } else{ //image format no support, get path original image - $image_height_width = resize_image($image, $thumbnail_width, $thumbnail_height, 1); - $image_height = $image_height_width[0]; - $image_width = $image_height_width[1]; + + if($original_image_size['width']>$max_thumbnail_width || $original_image_size['height']>$max_thumbnail_height){ + $image_height_width = resize_image($image, $max_thumbnail_width, $max_thumbnail_height, 1); + $image_height = $image_height_width[0]; + $image_width = $image_height_width[1]; + } + else{ + $image_height=$original_image_size['height']; + $image_width=$original_image_size['width']; + } + $doc_url = ($path && $path !== '/') ? $path.'/'.$one_image_file : $path.$one_image_file; - $image_tag[] = ''; + $image_tag[] = ''; }//end allowed image types }//end if exist file image }//end foreach diff --git a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_thumbnail_listing.php b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_thumbnail_listing.php index 60d431eead..1a0ffbfa83 100644 --- a/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_thumbnail_listing.php +++ b/main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/_ajax_get_thumbnail_listing.php @@ -109,12 +109,13 @@ foreach ($fileList as $file) { //check thumbnail $imagetype = explode(".", $image); $imagetype = strtolower($imagetype[count($imagetype)-1]);//or check $imagetype = image_type_to_extension(exif_imagetype($image), false); + $original_image_size = api_getimagesize($image); - if(in_array($imagetype,$allowed_thumbnail_types)) { + if(in_array($imagetype,$allowed_thumbnail_types) && $original_image_size['width']>$max_thumbnail_width || $original_image_size['height']>$max_thumbnail_height) { if (!file_exists($image_thumbnail)){ - $original_image_size = api_getimagesize($image); + switch($imagetype) { case 'gif': $source_img = imagecreatefromgif($image); @@ -178,7 +179,7 @@ foreach ($fileList as $file) { echo '' . "\n"; } else{ - + echo '' . "\n"; }//end allowed image types }//end if exist file image