theseconddre/pattern-creator

使用php GD生成特定可定制的图案

dev-master 2020-02-02 17:58 UTC

This package is not auto-updated.

Last update: 2024-09-17 15:26:03 UTC


README

使用php GD生成特定、可定制和图形图案。

Example of random pattern

如何安装我的包?:-)

非常简单:只需将以下行添加到你的composer.json文件中的require块中

"require": {
	"theseconddre/pattern-creator": "dev-master"
}

如何使用我的类?

然后,如果你想在你的浏览器中生成一个由正方形组成的蓝色图案,只需输入以下几行代码(已在PatternCreator/examples/index.php中编写)

<?php 

// Example 1 : display pattern in browser
// See more examples in examples/index.php 

$pattern = new TheSecondDre\PatternCreator([
		'width' 	=>  1000,
		'height' 	=>  1000,
		'color' 	=>  '#0000ff',
		'pattern' 	=>  'square',
	]);

$img = $pattern->createPattern('browser');
die();

当然,你可以在/src/img_patterns中添加自己的图案文件。