]> git.mjollnir.org Git - moodle.git/commitdiff
Changes to support GD 1 and GD 2. Well, to be more accurate, we now
authormartin <martin>
Thu, 13 Jun 2002 11:18:52 +0000 (11:18 +0000)
committermartin <martin>
Thu, 13 Jun 2002 11:18:52 +0000 (11:18 +0000)
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

config-dist.php
user/edit.php
user/lib.php

index 638f9704dfa83caa8f96af3d85e5e867fb2f523e..035806c360678ab5fdd2abdcceba2db401f06bae 100644 (file)
@@ -71,6 +71,12 @@ $CFG->lang     = "en";
 $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.
 ///////////////////////////////////////////////////////////////////////////
index 36db01e35fee7fefde2026c1361df56f0a3c2346..9e06031e2ecca9935e9e393d88872c9874eeab70 100644 (file)
@@ -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 {
index b9dce9eb40d9f21725b54d323e9e58d4ecb2f246..07eafa7cba0f8cc38b5d0b56bf150c4f2dd10a55 100644 (file)
@@ -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);
     }