2

我们有一些图像,我们想从中创建不同尺寸的壁纸,例如 800x600、1024x768 或 1600x1200。

例如,我们有这张图片http://colourlovers.com.s3.amazonaws.com/images/patterns/1440/1440297.png?1303733122

我们如何通过php创建壁纸?

所以图案是平铺的背景,它们在所有轴上重复,我们从 top:0 和 left:0 开始,并在它不适合所需大小时继续。

这是一个示例,在右侧块中(获取此图案图像) http://www.colourlovers.com/pattern/1440297/Spring_Forward

4

2 回答 2

4
$width = 1440;
$height = 900;

$pattern = imagecreatefrompng('1440297.png');
$image = imagecreatetruecolor($width, $height);

imagesettile($image, $pattern);
imagefill($image, 0, 0, IMG_COLOR_TILED);

header('Content-type: image/png');
imagepng($image);
于 2011-04-25T12:33:52.217 回答
0

查看本教程,它将向您展示如何创建漂亮且可重用的类来调整图像大小

http://net.tutsplus.com/tutorials/php/image-resizing-made-easy-with-php/

于 2011-04-25T13:12:09.920 回答