Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 0.7.0

Bug #10235 color_mode "paragraph" broken
Submitted: 2007-03-01 17:05 UTC
From: ringerl at gmail dot com Assigned: stoyan
Status: Closed Package: Image_Text (version 0.5.2beta2)
PHP Version: 5.2.0 OS: Windows
Roadmaps: (Not assigned)    
Subscription  


 [2007-03-01 17:05 UTC] ringerl at gmail dot com (David Ringhofer)
Description: ------------ As you can see in the test script color_mode paragraph is broken. The color cycling doesn't work properly. While the 3rd paragraph should have color 3 it gets color 2. Test script: --------------- <?php require_once 'Image/Text.php'; function check_err($obj) { if (PEAR::isError($obj)) { die ($obj->getMessage()); } } $img = ImageCreate (100, 100); ImageColorAllocate ($img, 0, 0, 0); $options = array( 'cx' => 50, 'cy' => 50, 'width' => 75, 'height' => 75, 'canvas' => $img, 'color' => array('#f5ba47', '#eeeeee', '#999999'), 'max_lines' => 5, 'min_font_size' => 1, 'max_font_size' => 20, 'color_mode' => 'paragraph', 'font_path' => 'php/fonts/', 'antialias' => true, 'font_file' => 'myriad.ttf', 'halign' => IMAGE_TEXT_ALIGN_CENTER, 'valign' => IMAGE_TEXT_ALIGN_MIDDLE ); $string = "1\n2\n3"; // Neues Objekt erstellen $img_text = new Image_Text($string,$options); check_err($img_text); // Objekt initialisieren $erg=$img_text->init(); check_err($erg); // Ideale Textgroesse ermitteln lassen $erg=$img_text->autoMeasurize(); check_err($erg); // Grafik berechnen $erg=$img_text->render(); check_err($erg); // Daten an Browser senden //$erg=$img_text->display(); //check_err($erg); //Debug print "<html><body><pre>"; print_r($img_text); print "</pre></body></html>"; ?> Expected result: ---------------- Image_Text Object ( [options] => Array ( [x] => 0 [y] => 0 [canvas] => Array ( [height] => 100 [width] => 100 ) [antialias] => 1 [width] => 75 [height] => 75 [halign] => center [valign] => middle [angle] => 0 [color] => Array ( [0] => Array ( [r] => 245 [g] => 186 [b] => 71 [a] => 0 ) [1] => Array ( [r] => 238 [g] => 238 [b] => 238 [a] => 0 ) [2] => Array ( [r] => 153 [g] => 153 [b] => 153 [a] => 0 ) ) [color_mode] => paragraph [font_path] => php/fonts/ [font_file] => myriad.ttf [font_size] => 19 [line_spacing] => 0.5 [min_font_size] => 1 [max_font_size] => 20 [image_type] => 3 [dest_file] => [cx] => 50 [cy] => 50 [max_lines] => 5 ) [_reInits] => Array ( [0] => width [1] => height [2] => canvas [3] => angle [4] => font_file [5] => font_path [6] => font_size ) [_text] => 1 2 3 [_img] => Resource id #4 [_tokens] => Array ( [0] => 1 [1] => [2] => 2 [3] => [4] => 3 ) [_font] => php/fonts/myriad.ttf [bbox] => Array ( [0] => Array ( [0] => 48 [1] => 32 [2] => 55 [3] => 32 [4] => 55 [5] => 15 [6] => 48 [7] => 15 ) [1] => Array ( [0] => 46 [1] => 60 [2] => 57 [3] => 60 [4] => 57 [5] => 42 [6] => 46 [7] => 42 ) [2] => Array ( [0] => 46 [1] => 89 [2] => 57 [3] => 89 [4] => 57 [5] => 71 [6] => 46 [7] => 71 ) ) [_mode] => [colors] => Array ( [0] => 1 [1] => 2 [2] => 3 ) [_realTextSize] => Array ( [width] => 11 [height] => 75 ) [_lines] => Array ( [0] => Array ( [string] => 1 [width] => 7 [height] => 17 [bottom_margin] => -1 [left_margin] => 1 [color] => 1 ) [1] => Array ( [string] => 2 [width] => 11 [height] => 18 [bottom_margin] => -1 [left_margin] => 0 [color] => 2 ) [2] => Array ( [string] => 3 [width] => 11 [height] => 18 [bottom_margin] => -1 [left_margin] => 0 [color] => 3 ) ) [_measurizedSize] => 19 [_init] => 1 ) Actual result: -------------- Image_Text Object ( [options] => Array ( [x] => 0 [y] => 0 [canvas] => Array ( [height] => 100 [width] => 100 ) [antialias] => 1 [width] => 75 [height] => 75 [halign] => center [valign] => middle [angle] => 0 [color] => Array ( [0] => Array ( [r] => 245 [g] => 186 [b] => 71 [a] => 0 ) [1] => Array ( [r] => 238 [g] => 238 [b] => 238 [a] => 0 ) [2] => Array ( [r] => 153 [g] => 153 [b] => 153 [a] => 0 ) ) [color_mode] => paragraph [font_path] => php/fonts/ [font_file] => myriad.ttf [font_size] => 19 [line_spacing] => 0.5 [min_font_size] => 1 [max_font_size] => 20 [image_type] => 3 [dest_file] => [cx] => 50 [cy] => 50 [max_lines] => 5 ) [_reInits] => Array ( [0] => width [1] => height [2] => canvas [3] => angle [4] => font_file [5] => font_path [6] => font_size ) [_text] => 1 2 3 [_img] => Resource id #4 [_tokens] => Array ( [0] => 1 [1] => [2] => 2 [3] => [4] => 3 ) [_font] => php/fonts/myriad.ttf [bbox] => Array ( [0] => Array ( [0] => 48 [1] => 32 [2] => 55 [3] => 32 [4] => 55 [5] => 15 [6] => 48 [7] => 15 ) [1] => Array ( [0] => 46 [1] => 60 [2] => 57 [3] => 60 [4] => 57 [5] => 42 [6] => 46 [7] => 42 ) [2] => Array ( [0] => 46 [1] => 89 [2] => 57 [3] => 89 [4] => 57 [5] => 71 [6] => 46 [7] => 71 ) ) [_mode] => [colors] => Array ( [0] => 1 [1] => 2 [2] => 3 ) [_realTextSize] => Array ( [width] => 11 [height] => 75 ) [_lines] => Array ( [0] => Array ( [string] => 1 [width] => 7 [height] => 17 [bottom_margin] => -1 [left_margin] => 1 [color] => 1 ) [1] => Array ( [string] => 2 [width] => 11 [height] => 18 [bottom_margin] => -1 [left_margin] => 0 [color] => 2 ) [2] => Array ( [string] => 3 [width] => 11 [height] => 18 [bottom_margin] => -1 [left_margin] => 0 [color] => 2 ) ) [_measurizedSize] => 19 [_init] => 1 )

Comments

 [2007-03-01 17:07 UTC] ringerl at gmail dot com
[_lines][2][color] = 2 while it should be 3
 [2007-03-10 06:00 UTC] stoyan (Stoyan Stefanov)
Hi David, Thanks for the report! This is now fixed in CVS. Here's the link to the CVS version: http://cvs.php.net/viewvc.cgi/pear/Image_Text/Image/Text.php?revision=1.29 Best, Stoyan