class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
more info about the class
See all posts Reply
--- class.upload_0.26RC2.php 2008-11-03 22:44:42.000000000 +0100 +++ class.upload_0.26RC2_borlander.php 2008-11-03 22:46:06.000000000 +0100 @@ -2567,7 +2567,7 @@ } // fills with background color if any is set if ($fill && !empty($this->image_background_color) && !$trsp) { - sscanf($this->image_background_color, "#%2x%2x%2x", $red, $green, $blue); + sscanf($this->image_background_color, "#%2x%2x%2x", $red=0, $green=0, $blue=0); $background_color = imagecolorallocate($dst_im, $red, $green, $blue); imagefilledrectangle($dst_im, 0, 0, $x, $y, $background_color); } @@ -3336,7 +3336,7 @@ if ($ct < 0 || $cr < 0 || $cb < 0 || $cl < 0 ) { // use the background color if present if (!empty($this->image_background_color)) { - sscanf($this->image_background_color, "#%2x%2x%2x", $red, $green, $blue); + sscanf($this->image_background_color, "#%2x%2x%2x", $red=0, $green=0, $blue=0); $fill = imagecolorallocate($tmp, $red, $green, $blue); } else { $fill = imagecolorallocatealpha($tmp, 0, 0, 0, 127); @@ -3418,7 +3418,7 @@ // add brightness, contrast and tint, turns to greyscale and inverts colors if ($gd_version >= 2 && ($this->image_negative || $this->image_greyscale || is_numeric($this->image_threshold)|| is_numeric($this->image_brightness) || is_numeric($this->image_contrast) || !empty($this->image_tint_color))) { $this->log .= '- apply tint, light, contrast correction, negative, greyscale and threshold '; - if (!empty($this->image_tint_color)) sscanf($this->image_tint_color, "#%2x%2x%2x", $tint_red, $tint_green, $tint_blue); + if (!empty($this->image_tint_color)) sscanf($this->image_tint_color, "#%2x%2x%2x", $tint_red=0, $tint_green=0, $tint_blue=0); imagealphablending($image_dst, true); for($y=0; $y < $this->image_dst_y; $y++) { for($x=0; $x < $this->image_dst_x; $x++) { @@ -3549,8 +3549,8 @@ if ($this->image_bevel > 0) { if (empty($this->image_bevel_color1)) $this->image_bevel_color1 = '#FFFFFF'; if (empty($this->image_bevel_color2)) $this->image_bevel_color2 = '#000000'; - sscanf($this->image_bevel_color1, "#%2x%2x%2x", $red1, $green1, $blue1); - sscanf($this->image_bevel_color2, "#%2x%2x%2x", $red2, $green2, $blue2); + sscanf($this->image_bevel_color1, "#%2x%2x%2x", $red1=0, $green1=0, $blue1=0); + sscanf($this->image_bevel_color2, "#%2x%2x%2x", $red2=0, $green2=0, $blue2=0); $tmp = $this->imagecreatenew($this->image_dst_x, $this->image_dst_y); imagecopy($tmp, $image_dst, 0, 0, 0, 0, $this->image_dst_x, $this->image_dst_y); imagealphablending($tmp, true);