From 6d415fb360c080f9bb04bdda5a4a408e236225ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Carlos=20Ra=C3=B1a?= Date: Tue, 24 Jul 2012 20:46:12 +0200 Subject: [PATCH] Feature #5142 fix thumbnail support for bmp files --- main/document/slideshow.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/main/document/slideshow.php b/main/document/slideshow.php index 4eae38a57c..5482c8a612 100644 --- a/main/document/slideshow.php +++ b/main/document/slideshow.php @@ -238,7 +238,8 @@ if ($slide_id == 'all') { if(in_array($imagetype,$allowed_thumbnail_types)) { if (!file_exists($image_thumbnail)){ - $original_image_size = api_getimagesize($image);//run each once we view thumbnails is too heavy, then need move into !file_exists($image_thumbnail, and only run when haven't the thumbnail + $original_image_size = api_getimagesize($image);//run each once we view thumbnails is too heavy, then need move into !file_exists($image_thumbnail, and only run when haven't the thumbnail + switch($imagetype) { case 'gif': $source_img = imagecreatefromgif($image); @@ -307,19 +308,19 @@ if ($slide_id == 'all') { //if images aren't support by gd (not gif, jpg, jpeg, png) if ($imagetype=="bmp"){ - $original_image_size = api_getimagesize($image);//it isn't heavey here because thumbnails are already created. Here only for no gif, jpg, or png image files. But if there are many image files no supported can be heavy here too. - 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]; + $original_image_size = getimagesize($image);// use getimagesize instead api_getimagesize($image); becasuse api_getimagesize doesn't support bmp files. Put here for each show, only for a few bmp files isn't heavy + if($original_image_size[0]>$max_thumbnail_width || $original_image_size[1]>$max_thumbnail_height){ + $thumbnail_size=api_calculate_image_size($original_image_size[0], $original_image_size[1], $max_thumbnail_width, $max_thumbnail_height);//don't use resize_image because doesn't run with bmp files + $image_height = $thumbnail_size['height']; + $image_width = $thumbnail_size['width']; } else{ - $image_height=$original_image_size['height']; - $image_width=$original_image_size['width']; + $image_height=$original_image_size[0]; + $image_width=$original_image_size[1]; } } else{ - //example for svg files + //example for svg files,... $image_width=$max_thumbnail_width; $image_height=$max_thumbnail_height; }