PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Images » Image_Text » Bug #2265

init a heigth without a canvas

Details

Submitted2004-09-01 14:23 UTC
Fromanonymous at php dot net
Assignedtoby
StatusClosed
PackageImage_Text
PHP Version4.3.8
OSsun solaris
Roadmaps(Not assigned)

Comments

[2004-09-01 14:23 UTC] anonymous at php dot net

Description:
------------
[snip] ...
function init()
[snip] ...
if(empty($this->options['canvas'])) {
// Create new image from width && height of the clipping
$this->_img = imagecreatetruecolor(
$this->options['width'],
$this->options['width']);

... [snip]
may read like this
$this->_img = imagecreatetruecolor(
$this->options['width'],
$this->options['height']);

Reproduce code:
---------------
$text="Hello Pear";
$width = 80;
$height = 20;

$fontOptions = array("font_type" => "ttf",
"font_path" => "/usr/local/share/fonts/",
"font_file" => "arial.ttf",
"font_size" => 10,
'width' => $width,
'height' => $height,
'line_spacing' => 1,
'max_lines' => 1,
'color' => array(0,0,0),
'halign' => IMAGE_TEXT_ALIGN_LEFT
);

$tempText = new Image_Text($text, $fontOptions);
$tempText->init();
$img = &$tempText->getImg();
$bgcol = imagecolorallocate($img, 240, 240, 240);
imagefilledrectangle($img, 0, 0, $width, $height, $bgcol);

$tempText->measurize();
$tempText->render();
$tempText->display();

Expected result:
----------------
Should Produce an Image with width = 80 and height = 20

Actual result:
--------------
Produce an Image with width = 80 and height = 80

[2004-09-07 16:06 UTC] anonymous2 at ano dot net

This occurs in
0.5.2beta1
0.5.1beta
0.5.0
0.4pl1
0.4
later not testet.