DJ Mike's Tutorials: PHP

ImageMagick Functions

^

Imagick::setFillPatternURL

Description:
bool ImagickDraw::setFillPatternURL ( string $fill_url )

Sets the URL to use as a fill pattern for filling objects. Only local URLs ("#identifier") are supported at this time. These local URLs are normally created by defining a named fill pattern with PushPattern/PopPattern.

Parameters:
fill_url
URL to use to obtain fill pattern.
Return Values
Returns TRUE on success or FALSE on failure.

Example


Text
<?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->compositeImagick::COMPOSITE_OVER00375140$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->annotation0$offset"$text);

# apply draw object to imagick object
$pallete->drawImage$draw );
# give it a raised border
$pallete->raiseImage1010140100TRUE);
# set format
$pallete->setImageFormat'png' );
# Output the image 
header"Content-Type: image/png" );
echo 
$pallete;
?>


^


Created by DJ Mike from Santa Barbara

DJ Mike


Dance Away Santa Barbara's Home Page
<a href="http://www.statcounter.com/" target="_blank"> <img src="http://c5.statcounter.com/counter.php?sc_project=1321035&java=0&security=da2193dc" alt="counter free hit invisible" border="0" /></a>