Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0002817 [Quercus] minor always 08-03-08 02:16 08-07-08 10:33
Reporter stephaneeybert View Status public  
Assigned To ferg
Priority normal Resolution fixed Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 3.2.1 Product Version
  Product Build
Summary 0002817: Color codes not rendered correctly
Description Dear all,

I have a php function that creates an images on the fly with a colored rectangle.
  // Print a bar image
  function printBarImage($color, $width, $height) {
    // Create a blank image
    $image = imagecreatetruecolor($width, $height);

    if (strlen($color) == 6) {
      $color = "#" . $color;
      }

    $r = intval(substr($color, 1, 2), 16);
    $g = intval(substr($color, 3, 2), 16);
    $b = intval(substr($color, 5, 2), 16);
    $color = imagecolorallocate($image, $r, $g, $b);

    // Fill up the image background
    imagefilledrectangle($image, 0, 0, $width, $height, $color);

    // Header indicating the image type
    header("Content-type:image/jpeg");

    // Create the image in the best jpeg quality
    imagejpeg($image,'',100);

    // Destroy the image
    imagedestroy($image);
    }

The passed color is 9933CC and it should appear as a light blue instead of some greenish color.

The issue happens with other color codes as well.
Steps To Reproduce
Additional Information This is on Resin 3.1.6 on Linux.

Attached Files

- Relationships

- Notes
(0003293)
ferg
08-07-08 10:33

php/120z

The problem is with the intval function.
 

- Issue History
Date Modified Username Field Change
08-03-08 02:16 stephaneeybert New Issue
08-05-08 07:07 ferg Project Resin => Quercus
08-07-08 10:33 ferg Note Added: 0003293
08-07-08 10:33 ferg Assigned To  => ferg
08-07-08 10:33 ferg Status new => closed
08-07-08 10:33 ferg Resolution open => fixed
08-07-08 10:33 ferg Fixed in Version  => 3.2.1


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
30 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker