2010年1月21日木曜日

phpでアイコン作成

 いい加減、php 飽きてきたけど、ボリュームが多くて終わる気がしないし、ツール選択の余地もない。という状況ですが、みなさん、いかがお過ごしでしょうか?これを C++ で書いたら、しんどいです。アイコン作成…ゆりかごから墓場まで…どんだけー。


<?php

$width = 30;
$height = 20;
$basename = 'r_';
$n = 400;

$top_x = 5;
$top_y = 3;


for( $i = 1; $i < $n; ++$i ) {
$img = imagecreate( $width, $height );
$wkc = imagecolorallocate( $img, 255, 0, 0 );
$bkc = imagecolorallocate( $img, 255, 172, 172 );
$wmc = imagecolorallocate( $img, 255, 255, 255 );
$fmc = imagecolorallocate( $img, 0, 0, 0 );
imagefilledrectangle( $img, 0, 0, $width-1, $height-1, $bkc );
imagesetthickness( $img, 3 );
imagerectangle( $img, 0, 0, $width-1, $height-1, $wkc );
$str = sprintf( "%3d", $i );
for( $x = 0; $x < 3; ++$x ) {
for( $y = 0; $y < 3; ++$y ) {
imagestring( $img, 3, $top_x + $x - 1, $top_y + $y - 1, $str, $wmc );
}
}
imagestring( $img, 3, $top_x, $top_y, $str, $fmc );
imagegif( $img, $basename . "{$i}.gif" );
imagedestroy( $img );
}


?>

0 件のコメント: