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: image_processor.php and GIF  (Read 5075 times)

0 Members and 1 Guest are viewing this topic.

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
image_processor.php and GIF
« on: February 19, 2005, 02:43:33 am »

It's been a while since I worked on the GIF support, but I see that this

Code: [Select]
function get_handle($path_to_primary_image) {

global $lang_image_processor_php;

// Let's use this information to create the handle with which to hold our lovely
// image. The variable $image_handle is the handle that points to the image's
// location in memory. Other handle creating functions are available (wireless
// bitmap, for example), but they are very rarely needed. You can learn about
// them at php.net in the function library. Look under image functions. If you
// desire, you could add these types to the following if-then-else statements.

$source_image_size_and_type = getimagesize ($path_to_primary_image) or die($lang_image_processor_php['file_corrupt']);
$source_image_width = $source_image_size_and_type[0];
$source_image_height = $source_image_size_and_type[1];
$source_image_type = $source_image_size_and_type[2];

if ($source_image_type == "1") {

        // The image is a GIF file, which we cannot use due to the Unisys patent.
        // The image can be read by GD, but GD cannot create it again. It is
        // possible to convert a GIF to PNG format using a command line call to
        // the appropriate program (i.e. GIF2PNG), but the installation of this
        // program on servers is by no means consistent. Therefore, we will
        // forgo GIF support. We will return an error.

        cpg_die(CRITICAL_ERROR, $lang_image_processor_php['GD_GIF_Warning'], __FILE__, __LINE__);

doesn't allow GIF images, even though there's a check for gif support in init.inc.php.  Shouldn't it be

Code: [Select]
function get_handle($path_to_primary_image) {

global $lang_image_processor_php;

// Let's use this information to create the handle with which to hold our lovely
// image. The variable $image_handle is the handle that points to the image's
// location in memory. Other handle creating functions are available (wireless
// bitmap, for example), but they are very rarely needed. You can learn about
// them at php.net in the function library. Look under image functions. If you
// desire, you could add these types to the following if-then-else statements.

$source_image_size_and_type = getimagesize ($path_to_primary_image) or die($lang_image_processor_php['file_corrupt']);
$source_image_width = $source_image_size_and_type[0];
$source_image_height = $source_image_size_and_type[1];
$source_image_type = $source_image_size_and_type[2];

if ($source_image_type == "1") {

        // The image is a GIF file, which we cannot use due to the Unisys patent.
        // The image can be read by GD, but GD cannot create it again. It is
        // possible to convert a GIF to PNG format using a command line call to
        // the appropriate program (i.e. GIF2PNG), but the installation of this
        // program on servers is by no means consistent. Therefore, we will
        // forgo GIF support. We will return an error.
        if ($CONFIG['GIF_support'] == 1) {
            $image_handle = imagecreatefromgif($path_to_primary_image);
        } else {
            cpg_die(CRITICAL_ERROR, $lang_image_processor_php['GD_GIF_Warning'], __FILE__, __LINE__);
        }

imagecreatetruecolor doesn't apply to GIF images.  Any time a GIF is written it must be imagecreate.  Checks must be put into this file to allow for proper GIF creation.  I also noticed the function ImageIsTrueColor is used in this file, but only php >= 4.3.2 supports it.
« Last Edit: November 03, 2005, 06:10:34 am by kegobeer »
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

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: image_processor.php and GIF
« Reply #1 on: February 20, 2005, 02:45:16 pm »

Since this isn't used by default, I'm not too worried about getting this fixed before, well, yesterday I guess.  Joachim, is this designed to be some sort of replacement for db_input?  When were you looking at doing the replacement?
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

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: image_processor.php and GIF
« Reply #2 on: February 25, 2005, 04:19:45 am »

I've made the appropriate changes for GIF support.  I didn't bother to add checks to eliminate the php 4.3+ functions, because the majority of this file is designed for a much better version of php than 4.1.0.  I don't understand the point of this file, since it only is used for single file uploads, and it appears that the only thing it does is rotate images.  Oh well, must be some reason for it I don't quite get.

There isn't code in db_input.php that grabs any of the post data that's sent after the image manipulation is done, so this file doesn't do anything right now.  I also had to comment out the spring cleaning function, since it's also in logging.inc.php.

Haven't committed any changes yet.  Is there any real point in my doing so?
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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: image_processor.php and GIF
« Reply #3 on: July 31, 2005, 12:12:54 pm »

[moderation]
bumping this unresolved thread to the top...
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: image_processor.php and GIF
« Reply #4 on: July 31, 2005, 01:38:23 pm »

I'm still waiting for word on this, Joachim.  This file isn't used anywhere, so is there any point in having it?
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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: image_processor.php and GIF
« Reply #5 on: July 31, 2005, 03:42:47 pm »

please go ahead and commit.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: image_processor.php and GIF
« Reply #6 on: August 15, 2005, 07:24:05 am »

*bump*
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: image_processor.php and GIF
« Reply #7 on: October 22, 2005, 12:05:00 am »

did you commit?
Logged

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: image_processor.php and GIF
« Reply #8 on: October 22, 2005, 02:03:39 am »

Not yet.  I have to recreate the changes as my test box crashed.  I should have it done this weekend.
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

kegobeer

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 4637
  • Beer - it does a body good!
    • The Kazebeer Family Website
Re: image_processor.php and GIF
« Reply #9 on: November 03, 2005, 06:01:30 am »

Changes committed.  There were several code blocks repeated, so I commented them out and wrote a new function.  That function is now called twice instead of repeating identical lines over and over again.  GIF support is added into the file.  spring_cleaning is commented out, since it's now in two separate files.  No reason to have it in a third.
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 20 queries.