Set the tile image for filling in PHP

Description

The following code shows how to set the tile image for filling.

Example


<?php/* ww  w .j  a v  a 2 s.  co  m*/
// Load an external image
$zend = imagecreatefromgif('./test.gif');

// Create a 200x200 image
$im = imagecreatetruecolor(200, 200);

// Set the tile
imagesettile($im, $zend);

// Make the image repeat
imagefilledrectangle($im, 0, 0, 199, 199, IMG_COLOR_TILED);

// Output image to the browser
header('Content-Type: image/png');

imagepng($im);
imagedestroy($im);
imagedestroy($zend);
?>

The code above generates the following result.

Set the tile image for filling in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text