coppermine-gallery.com/forum

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Upload => Topic started by: dshade69 on August 25, 2004, 10:23:49 AM

Title: New GD library, still can not upload Gif's.
Post by: dshade69 on August 25, 2004, 10:23:49 AM
I worked things out with my hosting provider to have the GD libraries upgraded so gif writing would work again.  However when I try to upload a gif, I still get "Not a GD extension"

Using gd_info I get the following:

array(11) {
     ["GD Version"]=> string(13) "2.0 or higher"
     ["FreeType Support"]=> bool(true)
     ["FreeType Linkage"]=> string(13) "with freetype"
     ["T1Lib Support"]=> bool(false)
     ["GIF Read Support"]=> bool(true)
     ["GIF Create Support"]=> bool(true)
     ["JPG Support"]=> bool(true)
     ["PNG Support"]=> bool(true)
     ["WBMP Support"]=> bool(true)
     ["XBM Support"]=> bool(false)
     ["JIS-mapped Japanese Font Support"]=> bool(false) }

Is there anything that I need to change in coppermine itself to be able to upload gif's, or if not does anyone know what the problem might be?

Thank you,

Cory Waggoner
Title: Re: New GD library, still can not upload Gif's.
Post by: Joachim Müller on August 25, 2004, 10:39:11 AM
Yes, you need to modify coppermine code. Modify include/picmgmt.inc.php like this: $gifsupport = 0;
// Check for GIF create support >= GD v2.0.28
if ($method == 'gd2') {
$gdinfo = gd_info();
$gifsupport = $gdinfo["GIF Create Support"];
}

        // GD can only handle JPG & PNG images
    if ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG && ($gifsupport && $imginfo[2] != GIS_GIF) && ($method == 'gd1' || $method == 'gd2')) {
        $ERROR = $lang_errors['gd_file_type_err'];
        return false;
    }


GauGau
Title: Re: New GD library, still can not upload Gif's.
Post by: dshade69 on August 25, 2004, 02:53:59 PM
Could you please let me know what code I need to replace with this code, or where in picmgmt.inc.php I need to place this code?
Title: Re: New GD library, still can not upload Gif's.
Post by: kegobeer on August 25, 2004, 03:44:41 PM
Read this thread:
http://forum.coppermine-gallery.net/index.php?topic=8376.0
Title: Re: New GD library, still can not upload Gif's.
Post by: dshade69 on August 26, 2004, 11:41:55 AM
Ok, following GauGau's code did not work for me then I followed the thread that kegobeer supplied, and that did not work for me either.  I have gif writing support, I know this by the various test that others have supplied to check and see if its enabled.  Looking through the code I noticed this section in upload.php:

/ JPEG and PNG only are allowed with GD. If the image is not allowed for GD,delete it.
               } elseif ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG && ($CONFIG['thumb_method'] == 'gd1' || $CONFIG['thumb_method'] == 'gd2')) {
                   @unlink($path_to_image);

                   // The file upload has failed -- the image is not allowed with GD.
                   $file_failure_array[] = array( 'failure_ordinal'=>$failure_ordinal, 'file_name'=> $file_name, 'error_code'=>$lang_upload_php['not_GD']);


The code I was supplied in previous posts all modified picmgmt.inc.php but nothing I saw modified upload.php.  Could someone show me how to modify this code if it needs to be modified?

Thank you,

Cory Waggoner
Title: Re: New GD library, still can not upload Gif's.
Post by: kegobeer on August 26, 2004, 03:14:40 PM
I forgot to post the changes in upload.php.  Sorry about that!

In upload.php:

after this
// Globalize $CONFIG.
global $CONFIG, $lang_upload_php, $user_form, $max_file_size;


add
$gifsupport = 0;
// Check for GIF create support >= GD v2.0.28
if ($method == 'gd2') {
    $gdinfo = gd_info();
    $gifsupport = $gdinfo["GIF Create Support"];
}


replace (around line 1270)
} elseif ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG && ($CONFIG['thumb_method'] == 'gd1' || $CONFIG['thumb_method'] == 'gd2')) {

with
} elseif ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG && ($CONFIG['thumb_method'] == 'gd1' || ($CONFIG['thumb_method'] == 'gd2' && !$gifsupport))) {

replace (around line 1942)
} elseif ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG && ($CONFIG['thumb_method'] == 'gd1' || $CONFIG['thumb_method'] == 'gd2')) {

with
} elseif ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG && ($CONFIG['thumb_method'] == 'gd1' || ($CONFIG['thumb_method'] == 'gd2' && !$gifsupport))) {

See if that gets it working.
Title: Re: New GD library, still can not upload Gif's.
Post by: dshade69 on August 27, 2004, 08:07:36 AM
Great, that did the trick.  At first it didn't work, but when I turned on debug mode I saw that there was a problem in  upload.php with $method not being defined.  After I fixed that, gif uploads seem to be working fine now.  Thanks for the help :)
Title: Re: New GD library, still can not upload Gif's.
Post by: kegobeer on August 27, 2004, 02:02:41 PM
Glad it worked.  For those who wonder about the $method problem, in upload.php:

find

// Globalize $CONFIG.
global $CONFIG, $lang_upload_php, $user_form, $max_file_size;


replace with

// Globalize $CONFIG.
global $CONFIG, $lang_upload_php, $user_form, $max_file_size, $method;
Title: Re: New GD library, still can not upload Gif's.
Post by: dshade69 on September 10, 2004, 08:09:16 AM
Well everything seem to be working fine but now all my images have lost their exif data, and no exif data is being saved when I upload pics.  I have already set up a mod to resize pictures, and I had the exif data working after that, so I am assuming when I changed the files to add gif support I somehow broke exif support.  Any ideas?  If no actual code, then even where to look.  I tried turning on debug but didn't see anything out of the ordinary.
Title: Re: New GD library, still can not upload Gif's.
Post by: taicomjp on October 25, 2005, 06:53:28 PM
still not work?
Title: Re: New GD library, still can not upload Gif's.
Post by: Joachim Müller on October 26, 2005, 12:05:44 AM
Quote from: dshade69 on September 10, 2004, 08:09:16 AM
Well everything seem to be working fine but now all my images have lost their exif data, and no exif data is being saved when I upload pics. I have already set up a mod to resize pictures, and I had the exif data working after that, so I am assuming when I changed the files to add gif support I somehow broke exif support. Any ideas? If no actual code, then even where to look. I tried turning on debug but didn't see anything out of the ordinary.
GD doesn't preserve exif data.

Quote from: taicomjp on October 25, 2005, 06:53:28 PM
still not work?
what's your actual question?
Title: Re: New GD library, still can not upload Gif's.
Post by: taicomjp on October 26, 2005, 01:39:08 AM
have gif support patch file?
Title: Re: New GD library, still can not upload Gif's.
Post by: kegobeer on October 26, 2005, 01:59:07 AM
http://forum.coppermine-gallery.net/index.php?topic=9407.0