Page 1 of 1

Using Imagick fill patterns results in blank text

Posted: 2010-05-02T14:44:29-07:00
by Morgon
Hi all,

I've been trying to implement fill patterns, as listed in Example 4 on http://www.php.net/manual/en/imagick.examples-1.php.
Unfortunately, I am getting blank text when the script executes (the example creates a border around the image which works, so it's not a general issue), and I'm not sure what I can do to change it.

I thought it might have been my newer software version (ImageMagick v6.6.1), as I have another machine which works fine using ImageMagick 6.5.8-10. However, even after downgrading, I continue to have this problem.

Is there anything else that I should be checking? I contacted Mikko, the author of Imagick, who suggested it might have been a configuration issue; but I have since removed all traces of other/older ImageMagick builds and re-installed 6.6.1, so I don't believe there should be any conflicts or confusion.

Thanks!

Re: Using Imagick fill patterns results in blank text

Posted: 2010-08-26T19:15:00-07:00
by DJ Mike
Here is another example

Code: Select all

<?php
# path to font
$font = "../../fonts/lokicola.ttf";
# text of annotation
$text = "DJ Mike";
# bgcolor
$bg = "#fad888";
# font size
$fontsize = 100;
# path to fill image
$pattern = new Imagick( '../../images/marb015.jpg' );
# offset to adjust image position
$offset = 14;
#########################################

# create imagick object
$pallete = new Imagick();
# give it size and color attributes
$pallete->newimage(375,140, "$bg");

# Create imagickdraw object
$draw = new ImagickDraw();
$draw->setfont("$font"); # set font

#### Start a new pattern called "marble" ####
$draw->pushPattern( 'marble'  , 0  , 0  , 360  , 270 );
# composite fill image over it
$draw->composite( Imagick::COMPOSITE_OVER, 0, 0, 375, 140, $pattern  );
# end pattern definition
$draw->popPattern();
#############################################

# Set pattern called "marble" as the fill
$draw->setFillPatternURL( '#marble' );
# set gravity
$draw->setgravity(imagick::GRAVITY_CENTER); 
# set font size
$draw->setFontSize( $fontsize );
# annotate
$draw->annotation( 0, $offset, "$text" );

# apply draw object to imagick object
$pallete->drawImage( $draw );
# give it a raised border
$pallete->raiseImage( 10, 10, 140, 100, TRUE);
# set format
$pallete->setImageFormat( 'png' );
# Output the image 
header( "Content-Type: image/png" );
echo $pallete;
?>
Imagick::setFillPatternURL
http://eclecticdjs.com/mike/tutorials/p ... ernurl.php