iPhone用壁紙作成php ソース付き
iPhone用の壁紙を作るphp描きました。
自分用ですが、なんとなく公開します。
こんなののタイルパターンです。
こちらから。http://ryokuondokei.com/mdhjlab/hex.php
直で画像です。
?step=xxと指定する事で、大きさが変わります。
20でこちら。
http://ryokuondokei.com/mdhjlab/hex.php?step=20
ソースは続きから。
思いつきながら、かつ最初は四角のタイルパターンだったので汚いコードですが、gdと戯れた結果です。
<?php $img = imagecreatetruecolor(640,960); $step=10; if(isset($_GET['step'])) $step=(int)$_GET['step']; if($step<5) $step=5; $black = ImageColorAllocate($img, 0x00, 0x00, 0x00); ImageFilledRectangle($img, 0,0, 100,100, $black); $q=0; for($i=0;$i<800;$i+=$step*3){ $q=0; for($j=0;$j<1200;$j+=$step){ $q=($q+1) % 2; //一段ごとに0/1 $r=rand(0,255); //描画色 $g=rand(0,127); //透明度 $z=rand(0,2); //緑or赤 $a=$q*$step*1.5; //互い違いにする為。 $p=array( $a+$i-$step,$j, $a+$i-$step/2,$j-$step/2, $a+$i+$step/2,$j-$step/2, $a+$i+$step,$j, $a+$i+$step/2,$j+$step/2, $a+$i-$step/2,$j+$step/2, $a+$i-$step,$j ); //六角形ポリゴン左から一周分。 //if($z<=1) contiune; //歯抜けを作るか。コメント中。 //緑or赤 if($z==2) $col = ImageColorAllocateAlpha($img, $r,0,0,$g); if($z!=2) $col = ImageColorAllocateAlpha($img, 0,$r,0,$g); imagefilledpolygon($img, $p, 7, $col); //塗って imagecolordeallocate($img,$col); //捨てる } } //出力 header('Content-Type: image/png'); ImagePNG($img); ?>