From 23097fc17ce5af3ca55368dda40895ed412a2bb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Loguercio?= Date: Fri, 13 Nov 2015 15:54:56 -0500 Subject: [PATCH] Fix code in old resize functions usage in image.lib.php --- main/admin/settings.lib.php | 7 +------ main/document/document.php | 7 +------ main/newscorm/learnpath.class.php | 16 ++-------------- main/social/my_skills_report.php | 6 +++--- 4 files changed, 7 insertions(+), 29 deletions(-) diff --git a/main/admin/settings.lib.php b/main/admin/settings.lib.php index b990cd3d5f..b8e5adbeb8 100755 --- a/main/admin/settings.lib.php +++ b/main/admin/settings.lib.php @@ -1033,12 +1033,7 @@ function add_edit_template() { $max_width_for_picture = 100; if ($picture_info['width'] > $max_width_for_picture) { - $thumbwidth = $max_width_for_picture; - if (empty($thumbwidth) || $thumbwidth == 0) { - $thumbwidth = $max_width_for_picture; - } - $new_height = round(($thumbwidth / $picture_info['width']) * $picture_info['height']); - $temp->resize($thumbwidth, $new_height, 0); + $temp->resize($max_width_for_picture); } $temp->send_image($upload_dir.$new_file_name); } diff --git a/main/document/document.php b/main/document/document.php index d3f07c8d23..d6f69707a8 100755 --- a/main/document/document.php +++ b/main/document/document.php @@ -1417,12 +1417,7 @@ if ($is_allowed_to_edit || $max_width_for_picture = 100; if ($picture_info['width'] > $max_width_for_picture) { - $thumbwidth = $max_width_for_picture; - if (empty($thumbwidth) || $thumbwidth == 0) { - $thumbwidth = $max_width_for_picture; - } - $new_height = round(($thumbwidth / $picture_info['width']) * $picture_info['height']); - $temp->resize($thumbwidth, $new_height, 0); + $temp->resize($max_width_for_picture); } $temp->send_image($upload_dir.$new_file_name); } diff --git a/main/newscorm/learnpath.class.php b/main/newscorm/learnpath.class.php index 7c8ed30002..a4203e865c 100755 --- a/main/newscorm/learnpath.class.php +++ b/main/newscorm/learnpath.class.php @@ -9685,19 +9685,7 @@ EOD; // Resize the image. $temp = new Image($image_array['tmp_name']); - $picture_infos = $temp->get_image_info(); - if ($picture_infos['width'] > 104) { - $thumbwidth = 104; - } else { - $thumbwidth = $picture_infos['width']; - } - if ($picture_infos['height'] > 96) { - $new_height = 96; - } else { - $new_height = $picture_infos['height']; - } - - $temp->resize($thumbwidth, $new_height, 0); + $temp->resize(104); $result = $temp->send_image($new_path); // Storing the image filename. @@ -9706,7 +9694,7 @@ EOD; $this->set_preview_image($new_file_name); //Resize to 64px to use on course homepage - $temp->resize(64, 64, 0); + $temp->resize(64); $temp->send_image($updir.'/'.$filename.'.64.'.$file_extension); return true; } diff --git a/main/social/my_skills_report.php b/main/social/my_skills_report.php index 7bf820b009..0f1105f07e 100644 --- a/main/social/my_skills_report.php +++ b/main/social/my_skills_report.php @@ -55,7 +55,7 @@ if ($isStudent) { if (!file_exists($thumbSysPath)) { $courseImageThumb = new Image($imageSysPath); - $courseImageThumb->resize(32, 32, 0); + $courseImageThumb->resize(32); $courseImageThumb->send_image($thumbSysPath); } $tableRow['courseImage'] = $thumbWebPath; @@ -100,7 +100,7 @@ if ($isStudent) { if (!file_exists($thumbSysPath)) { $courseImageThumb = new Image($imageSysPath); - $courseImageThumb->resize(32, 32, 0); + $courseImageThumb->resize(32); $courseImageThumb->send_image($thumbSysPath); } $tableRow['courseImage'] = $thumbWebPath; @@ -167,7 +167,7 @@ if ($isStudent) { if (!file_exists($thumbSysPath)) { $courseImageThumb = new Image($imageSysPath); - $courseImageThumb->resize(32, 32, 0); + $courseImageThumb->resize(32); $courseImageThumb->send_image($thumbSysPath); }