imagesetbrush
Description
The imagesetbrush of Image for PHP set the brush image for line drawing.
Syntax
imagesetbrush( GdImage $image, GdImage $brush ): bool
Parameters
image
A GdImage object, returned by one of the image creation functions, such as imagecreatetruecolor().
brush
An image object.
Return
Returns true on success or false on failure.
Examples
1 · return
<? $width = 100; $height = 100; $image = imagecreate($width, $height); $filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/png/1.png'; $brush = imagecreatefrompng($filename); $return = imagesetbrush($image, $brush); var_export($return); ?>
true
2 · base64
<? $width = 100; $height = 100; $image = imagecreatetruecolor($width, $height); $filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/png/Happy.png'; $brush = imagecreatefrompng($filename); imagesetbrush($image, $brush); $x1 = 50; $y1 = 50; $x2 = 60; $y2 = 60; $color = IMG_COLOR_BRUSHED; imageline($image, $x1, $y1, $x2, $y2, $color); ob_start(); imagepng($image); $output = ob_get_clean(); echo '<!doctype html> <html> <body> <img src="data:image/png;base64,' . base64_encode($output) . '"> </body> </html>'; ?>
<!doctype html> <html> <body> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAFBklEQVR4nO2dMW/TXBSGX/v7FkRlrphRelkYKpQaCSF1AEX8gvwAhMwfqIIEQxfI2Am5Cwui6lCGCBE6AkMVJJAoQ2pAQgxVaAJzUqKgRpAmDDENTdLGTs6913b86ChTdHzuk2Pn2r5xNCiCMZgmUikA7qth4NKl/rdtb6NeB4BCwX11HOztSSvzCJrMjXGOdBqpFJJJnD8/fp5yGY6DQgEbG9jdJSsvEJgmbBulEjod+qhUYNswTdWDnBDGkMmIcjQY378jkwFjqoftF86xtibJ0WA8eQLOVSvwglpN/8bTpwFWxhhsW72jvnj8OHg7ZiaDalW9mqHRbGJpSbWgLpxjc1O9kZGxs6N6r7Ss4DbUYLRauHNHkanVVfXjHyO2tuRqYgzFovphjx2NhqyjvmnKm2eKi4MDXL0q3lSIDl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K+j8QMWQB/cM5eNH/PqF69eF91eQ8SoLwJs3OHsWV65Mry8fsgC8eIELF3Dx4pT68icLQD6PuTnMzU2pr3HI5abxeB/78hqrq3F/eYticTJT0+OrVIJhUMgCsL4eZV/VKpJJIlNdVlai6YveVJelpaj5EmWqS5TOH8Wa6rKwgIMD9UOdMEol8aa6GAb99UKZUSzSffd5ZGtL/bDHiJNnnn8ARpmV/d1OabsAAAAASUVORK5CYII="> </body> </html>
Links
Related
Image
- gd_info
- getimagesize
- getimagesizefromstring
- image_type_to_extension
- image_type_to_mime_type
- imageaffine
- imageaffinematrixconcat
- imageaffinematrixget
- imagealphablending
- imageantialias
- imagearc
- imageavif
- imagebmp
- imagechar
- imagecharup
- imagecolorallocate
- imagecolorallocatealpha
- imagecolorat
- imagecolorclosest
- imagecolorclosestalpha
- imagecolorclosesthwb
- imagecolordeallocate
- imagecolorexact
- imagecolorexactalpha
- imagecolormatch
- imagecolorresolve
- imagecolorresolvealpha
- imagecolorset
- imagecolorsforindex
- imagecolorstotal
- imagecolortransparent
- imageconvolution
- imagecopy
- imagecopymerge
- imagecopymergegray
- imagecopyresampled
- imagecopyresized
- imagecreate
- imagecreatefromavif
- imagecreatefrombmp
- imagecreatefromgif
- imagecreatefromjpeg
- imagecreatefrompng
- imagecreatefromstring
- imagecreatefromtga
- imagecreatefromwbmp
- imagecreatefromwebp
- imagecreatefromxbm
- imagecreatefromxpm
- imagecreatetruecolor
- imagecrop
- imagecropauto
- imagedashedline
- imagedestroy
- imageellipse
- imagefill
- imagefilledarc
- imagefilledellipse
- imagefilledpolygon
- imagefilledrectangle
- imagefilltoborder
- imagefilter
- imageflip
- imagefontheight
- imagefontwidth
- imageftbbox
- imagefttext
- imagegammacorrect
- imagegetclip
- imagegetinterpolation
- imagegif
- imageinterlace
- imageistruecolor
- imagejpeg
- imagelayereffect
- imageline
- imageloadfont
- imageopenpolygon
- imagepalettecopy
- imagepalettetotruecolor
- imagepng
- imagepolygon
- imagerectangle
- imageresolution
- imagerotate
- imagesavealpha
- imagescale
- imagesetclip
- imagesetinterpolation
- imagesetpixel
- imagesetstyle
- imagesetthickness
- imagesettile
- imagestring
- imagestringup
- imagesx
- imagesy
- imagetruecolortopalette
- imagettfbbox
- imagettftext
- imagetypes
- imagewbmp
- imagewebp
- imagexbm
- iptcembed
- iptcparse