MDL-38654 do not test $CFG->gdversion

GD PHP extension is now required. Add-ons need to remove $CFG->gdversion tests. The worst case regression is that add-on will think GD is not available.
This commit is contained in:
Petr Škoda
2013-03-22 16:57:55 +01:00
parent 373a8e052c
commit 689096bc26
24 changed files with 101 additions and 147 deletions
+4 -8
View File
@@ -48,7 +48,7 @@ defined('MOODLE_INTERNAL') || die();
function imagecopybicubic($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) {
global $CFG;
if (function_exists('imagecopyresampled') and $CFG->gdversion >= 2) {
if (function_exists('imagecopyresampled')) {
return imagecopyresampled($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y,
$dst_w, $dst_h, $src_w, $src_h);
}
@@ -100,10 +100,6 @@ function imagecopybicubic($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $d
function process_new_icon($context, $component, $filearea, $itemid, $originalfile) {
global $CFG;
if (empty($CFG->gdversion)) {
return false;
}
if (!is_file($originalfile)) {
return false;
}
@@ -169,7 +165,7 @@ function process_new_icon($context, $component, $filearea, $itemid, $originalfil
return false;
}
if (function_exists('imagecreatetruecolor') and $CFG->gdversion >= 2) {
if (function_exists('imagecreatetruecolor')) {
$im1 = imagecreatetruecolor(100, 100);
$im2 = imagecreatetruecolor(35, 35);
$im3 = imagecreatetruecolor(512, 512);
@@ -274,7 +270,7 @@ function process_new_icon($context, $component, $filearea, $itemid, $originalfil
function generate_image_thumbnail($filepath, $width, $height) {
global $CFG;
if (empty($CFG->gdversion) or empty($filepath) or empty($width) or empty($height)) {
if (empty($filepath) or empty($width) or empty($height)) {
return false;
}
@@ -306,7 +302,7 @@ function generate_image_thumbnail($filepath, $width, $height) {
return false;
}
if (function_exists('imagecreatetruecolor') and $CFG->gdversion >= 2) {
if (function_exists('imagecreatetruecolor')) {
$thumbnail = imagecreatetruecolor($width, $height);
if ($imagefnc === 'imagepng') {
imagealphablending($thumbnail, false);