Permalink
Browse files

Changes to support GD 1 and GD 2. Well, to be more accurate, we now

rely on the administrator to tell us which is installed because PHP
is not reliable  (eg GD 2.* functions are available in 4.0.6 and later
EVEN WHEN gd 2 is not present ... sigh).


So, new config variable  $CFG->gdversion
  • Loading branch information...
martin
martin committed Jun 13, 2002
1 parent 849bc02 commit 22f4320bdb7d039e3ed818cf9b735301ce72f9ab
Showing with 10 additions and 2 deletions.
  1. +6 −0 config-dist.php
  2. +1 −1 user/edit.php
  3. +3 −1 user/lib.php
View
@@ -71,6 +71,12 @@
$CFG->smtphosts = "";
+// There is no way, currently, to automatically tell whether the graphic
+// library GD is version 1.* or 2.*. Specify that here (either 1 or 2).
+
+$CFG->gdversion = 1;
+
+
// You should not need to change anything else. To continue setting up
// Moodle, use your web browser to go to the moodle/admin web page.
///////////////////////////////////////////////////////////////////////////
View
@@ -47,7 +47,7 @@
case 3: $im = ImageCreateFromPNG($imagefile); break;
default: error("Image must be in JPG or PNG format");
}
- if (function_exists("ImageCreateTrueColor")) {
+ if (function_exists("ImageCreateTrueColor") and $CFG->gdversion >= 2) {
$im1 = ImageCreateTrueColor(100,100);
$im2 = ImageCreateTrueColor(35,35);
} else {
View
@@ -4,7 +4,9 @@
function ImageCopyBicubic ($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) {
- if (function_exists("ImageCopyResampled")) { // Assumes gd >= 2.0.1 as well
+ global $CFG;
+
+ if (function_exists("ImageCopyResampled") and $CFG->gdversion >= 2) {
return ImageCopyResampled($dst_img, $src_img, $dst_x, $dst_y, $src_x, $src_y,
$dst_w, $dst_h, $src_w, $src_h);
}

0 comments on commit 22f4320

Please sign in to comment.