使い方は簡単です。
下のフォームに「ローマ字5文字程度」で友達の名前を書いて、「作成ボタン」をクリックしてください。
// header( "Content-Type: text/html; Charset=utf-8" );
// header( "Expires: Wed, 31 May 2000 14:59:58 GMT" );
if ( $_POST['send'] == "作成" ) {
$ar = array("img0001.jpg", "img0002.jpg", "img0003.jpg", "img0005.jpg");
$file = "./img/".$ar[array_rand($ar)];
//$file = "./img/img0001.jpg";
// jpg画像を作成
$img = imagecreatefromjpeg( $file );
// 画像サイズ取得
$target = getimagesize( $file );
// フォントサイズ
// フォント角度
$fangle = 3;
// 位置
// x:左からの座標
// y:フォントペースラインの位置を指定
// フォントカラー
$fcolor = imagecolorallocate( $img, 255, 255, 255 );
// フォント
$fpath = "./font/FEASFBI_.TTF";
$fpathr = "./font/VL-PGothic-Regular.ttf";
// テキスト
// 文字コードは『UTF-8』に変換する
//$ftext = mb_convert_encoding( $_POST['txt'], "UTF-8", "EUC-JP" );
$ftext = $_POST['txt'].'!';
$ftext1 = $_POST['txt'].'-!!';
$fx = 8;
$fy = $fsize + 170;
$fsize = 16;
$fx1 = 10;
$fy1 = $fsize + 40;
$fsize1 = 24;
$fx2 = 100;
$fy2 = $fsize + 50;
$fsize2 = 56;
$fx3 = 300;
$fy3 = $fsize + 20;
$fsize3 = 36;
$fx4 = 200;
$fy4 = $fsize + 150;
$fsize4 = 88;
$fx5 = 20;
$fy5 = $fsize + 120;
$fsize5 = 40;
// テキスト挿入
imagettftext(
$img,
12,
0,
235,
320,
$fcolor,
$fpathr,
"made by daikansei stamp generator"
);
imagettftext(
$img,
$fsize,
$fangle,
$fx,
$fy,
$fcolor,
$fpath,
$ftext
);
imagettftext(
$img,
$fsize1,
$fangle,
$fx1,
$fy1,
$fcolor,
$fpath,
$ftext
);
imagettftext(
$img,
$fsize2,
$fangle,
$fx2,
$fy2,
$fcolor,
$fpath,
$ftext1
);
imagettftext(
$img,
$fsize3,
$fangle,
$fx3,
$fy3,
$fcolor,
$fpath,
$ftext
);
imagettftext(
$img,
$fsize4,
$fangle,
$fx4,
$fy4,
$fcolor,
$fpath,
$ftext1
);
imagettftext(
$img,
$fsize5,
$fangle,
$fx5,
$fy5,
$fcolor,
$fpath,
$ftext1
);
// 保存
// 最後の90は品質:デフォルトは75との事
imagejpeg( $img, "./img/sample.jpg", 90 );
imagedestroy( $img );
echo "
";
echo "※ベースの画像はネットから無作為に抽出しました。マズイのがあればご連絡ください(´・ω・`)。
";
}
?>
↑この画像を保存して、LINE等で送ってあげましょう(^^)。