New GD library, still can not upload Gif's. New GD library, still can not upload Gif's.
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

New GD library, still can not upload Gif's.

Started by dshade69, August 25, 2004, 10:23:49 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dshade69

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

Joachim Müller

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

dshade69

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?

kegobeer

Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

dshade69

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

kegobeer

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.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

dshade69

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 :)

kegobeer

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;
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

dshade69

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.

taicomjp


Joachim Müller

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?

taicomjp


kegobeer

Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots