Syntax:bool imagesettile ($image, $tile)
Parameters: this function takes two parameters as above and described below: - $image:is returned by one of the image creation functions such as imagecreatetruecolor(). Used to create the size of the image.
- $tile:this parameter is used to set the image resource as a tile.
Return value :This function returns True on success, or False on failure.The following programs illustrate the imagesettile() functionin PHP:Program 1:
// Load the png file
$image
= imagecreatefrompng (
’ https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-9.png ’
) ;
// Create a 400x250 image
$im
= imagecreatetruecolor (500, 250);
// Set image tile
imagesettile (
$im
,
$image
);
// Make the image repeated
imagefilledrectangle-method/">rectangle (
$im
, 0, 0, 450, 199, IMG_COLOR_TILED);
// Output image to browser
header (
’Content-Type: image / png’
);
imagepng (
$im
);
imagedestroy (
$im
);
imagedestroy (
$image
);
?>
Output: Program 2:
// Loading png file
$image
= imagecreatefrompng (
’ https: / /media.engineerforengineer.org/wp-content/uploads/engineerforengineer-9.png ’
);
// Create 670x350 image
$im
= imagecreatetruecolor (670, 350);
// Set image tile
imagesettile (
$im
,
$image
);
// Make the image repeated
imagefilledrectangle-method/">rectangle (
$im
, 0, 0, 670, 350, IMG_COLOR_TILED);
// Output image to browser
header (
’Content-Type: image / png’
);
imagepng (
$im
);
imagedestroy (
$im
);
imagedestroy (
$image
);
?>
Output: Link: http://php.net/manual/en/function.imagesettile.php