Advanced search  

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]

Pages: [1]   Go Down

Author Topic: New GD library, still can not upload Gif's.  (Read 6949 times)

0 Members and 1 Guest are viewing this topic.

dshade69

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
New GD library, still can not upload Gif's.
« 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
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: New GD library, still can not upload Gif's.
« Reply #1 on: August 25, 2004, 10:39:11 am »

Yes, you need to modify coppermine code. Modify include/picmgmt.inc.php like this:
Code: [Select]
$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
Logged

dshade69

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: New GD library, still can not upload Gif's.
« Reply #2 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?
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Logged
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

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: New GD library, still can not upload Gif's.
« Reply #4 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:

Code: [Select]
/ 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
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: New GD library, still can not upload Gif's.
« Reply #5 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
Code: [Select]
// Globalize $CONFIG.
global $CONFIG, $lang_upload_php, $user_form, $max_file_size;

add
Code: [Select]
$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)
Code: [Select]
} elseif ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG && ($CONFIG['thumb_method'] == 'gd1' || $CONFIG['thumb_method'] == 'gd2')) {
with
Code: [Select]
} elseif ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG && ($CONFIG['thumb_method'] == 'gd1' || ($CONFIG['thumb_method'] == 'gd2' && !$gifsupport))) {
replace (around line 1942)
Code: [Select]
} elseif ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG && ($CONFIG['thumb_method'] == 'gd1' || $CONFIG['thumb_method'] == 'gd2')) {
with
Code: [Select]
} elseif ($imginfo[2] != GIS_JPG && $imginfo[2] != GIS_PNG && ($CONFIG['thumb_method'] == 'gd1' || ($CONFIG['thumb_method'] == 'gd2' && !$gifsupport))) {
See if that gets it working.
Logged
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

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: New GD library, still can not upload Gif's.
« Reply #6 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 :)
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: New GD library, still can not upload Gif's.
« Reply #7 on: August 27, 2004, 02:02:41 pm »

Glad it worked.  For those who wonder about the $method problem, in upload.php:

find

Code: [Select]
// Globalize $CONFIG.
global $CONFIG, $lang_upload_php, $user_form, $max_file_size;

replace with

Code: [Select]
// Globalize $CONFIG.
global $CONFIG, $lang_upload_php, $user_form, $max_file_size, $method;
Logged
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

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 22
Re: New GD library, still can not upload Gif's.
« Reply #8 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.
Logged

taicomjp

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: New GD library, still can not upload Gif's.
« Reply #9 on: October 25, 2005, 06:53:28 pm »

still not work?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: New GD library, still can not upload Gif's.
« Reply #10 on: October 26, 2005, 12:05:44 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.

still not work?
what's your actual question?
Logged

taicomjp

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: New GD library, still can not upload Gif's.
« Reply #11 on: October 26, 2005, 01:39:08 am »

have gif support patch file?
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Logged
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
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 15 queries.