FAQ
Edit report at https://pear.php.net/bugs/bug.php?id=19206&edit=1

ID: 19206
Comment by: nino@recgr.com
Reported By: nino at recgr dot com
Summary: Script cannot create image
Status: Open
Type: Bug
Package: Image_Text
Operating System: Unix
Package Version: 0.6.1
PHP Version: 5.2.17
Roadmap Versions:
New Comment:

But I like the fact you are a SW fan


Previous Comments:
------------------------------------------------------------------------

[2012-01-09 01:57:38] ninoskopac

Description:
------------
[09-Jan-2012 01:44:20] PHP Warning: imagepng(): supplied
argument is not a valid Image resource in xxx on line 1102

Test script:
---------------
<?
require_once '/home/sknino/php/Image/Text.php';


$colors = array(
0 => '#0d54e2',
1 => '#e8ce7a',
2 => '#7ae8ad'
);

$text = "EXTERIOR: DAGOBAH -- DAY\nWith Yoda\nstrapped to\n\nhis back,
Luke climbs up one of the many thick vines that grow in the swamp until
he reaches the Dagobah statistics lab. Panting heavily, he continues his
exercises -- grepping, installing new packages, logging in as root, and
writing replacements for two-year-old shell scripts in PHP.\nYODA: Code!
Yes. A programmer's strength flows from code maintainability. But beware
of Perl. Terse syntax... more than one way to do it... default
variables. The dark side of code maintainability are they. Easily they
flow, quick to join you when code you write. If once you start down the
dark path, forever will it dominate your destiny, consume you it
will.\nLUKE: Is Perl better than PHP?\nYODA: No... no... no. Orderless,
dirtier, more seductive.\nLUKE: But how will I know why PHP is better
than Perl?\nYODA: You will know. When your code you try to read six
months from now...";

$options = array(
'canvas' => array('width'=> 600,'height'=> 600), //
Generate a new image 600x600 pixel
'cx' => 300, // Set center to the middle of
the canvas
'cy' => 300,
'width' => 300, // Set text box size
'height' => 300,
'line_spacing' => 1, // Normal linespacing
'angle' => 45, // Text rotated by 45
'color' => $colors, // Predefined colors
'background_color' => '#FF0000', //red background
'max_lines' => 100, // Maximum lines to render
'min_font_size' => 2, // Minimal/Maximal font size
(for automeasurize)
'max_font_size' => 50,
'font_path' => '../fonts/', // Settings for the
font file
'font_file' => 'HTOWERT.ttf',
'antialias' => true, // Antialiase font rendering
'halign' => IMAGE_TEXT_ALIGN_RIGHT, // Alignment
to the right and middle
'valign' => IMAGE_TEXT_ALIGN_MIDDLE
);

// Generate a new Image_Text object
$itext = new Image_Text($text, $options);

// Initialize and check the settings
$itext->init();

// Automatically determine optimal font size
$itext->autoMeasurize();

// Render the image
$itext->render();

// Display it
$itext->display();
?>

Expected result:
----------------
image

Actual result:
--------------
errors

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedJan 13, '12 at 10:39a
activeJan 13, '12 at 10:39a
posts1
users1
websitepear.php.net

1 user in discussion

Nino: 1 post

People

Translate

site design / logo © 2022 Grokbase