首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

imagesettile

(PHP 4 >= 4.0.6, PHP 5, PHP 7)

imagesettile - 设置平铺图像进行填充

描述

代码语言:javascript
复制
bool imagesettile ( resource $image , resource $tile )

当填充特殊颜色IMG_COLOR_TILED时,imagesettile()设置所有区域填充功能(例如imagefill()和imagefilledpolygon())使用的平铺图像。

tile是用于用重复图案填充区域的图像。任何 GD图像都可以用作图块,并且通过使用imagecolortransparent()设置图块图像的透明颜色索引,可以创建图块以允许底层区域的某些部分发光。

注意:

   当你完成一个图块时,你不需要采取特殊的行动,但是如果你破坏了图块图像,那么你必须使用IMG_COLOR_TILED颜色,直到你设置了新的图块图像为止!

参数

代码语言:txt
复制
`image`   

一个图像资源,由图像创建函数之一返回,如imagecreatetruecolor()。

tile

要用作图块的图像资源。

返回值

成功返回TRUE或失败时返回FALSE。

例子

示例#1 imagesettile()示例

代码语言:javascript
复制
<?php
// Load an external image
$zend = imagecreatefromgif('./zend.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);
?>

上面的例子会输出类似于:

← imagesetthickness

imagestring →

扫码关注腾讯云开发者

领取腾讯云代金券