我想使用 4px png 创建 600px png 叠加图案。这只是重复x轴。
$srcfile = '4px.png';
$outfile = 'overlay.png';
list($src_w,$src_h,$src_type) = getimagesize($srcfile);
$out_w = 600;
$out_h = 600;
$src = imagecreatefrompng($srcfile);
$out = imagecreatetruecolor($out_w, $out_h);
$curr_x = 0;
while($curr_x < $out_w){
$curr_y = 0;
while($curr_y < $out_h){
imagecopy($out, $src, $curr_y, 0, 0, 0, $src_w, $src_h);
$curr_y += $src_h;
}
$curr_x += $src_w;
}
imagepng($out, $outfile, 100);
imagedestroy($src);
imagedestroy($out);
工作 x-repeat 如下
$curr_x = 0;
while($curr_x < $out_w){
imagecopy($out, $src, $curr_x, 0, 0, 0, $src_w, $src_h);
$curr_x += $src_w;
}
我如何 Y-repat 上面的代码?