PHP
downloads | documentation | faq | getting help | mailing lists | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

GD 関数> <定義済み定数
Last updated: Fri, 05 Sep 2008

view this page in

例1 PHPによるPNGの生成

<?php

header
("Content-type: image/png");
$string $_GET['text'];
$im     imagecreatefrompng("images/button1.png");
$orange imagecolorallocate($im22021060);
$px     = (imagesx($im) - 7.5 strlen($string)) / 2;
imagestring($im3$px9$string$orange);
imagepng($im);
imagedestroy($im);

?>
この例のスクリプトは、<img src="button.php?text"> のようなタグによりあるページからコールされるものです。 上のbutton.phpスクリプトは、この "text" 文字列を引数と し、この場合は "images/button1.png" である基本イメージ の最上部にこの文字列を描いた後、描画後ののイメージを出力します。 この方法は、ボタンのテキストを変更する度に新規のボタンを生成する 必要があるのを回避するために便利な手法です。 この方法により、動的にイメージボタンを生成できます。



add a note add a note User Contributed Notes
There are no user contributed notes for this page.

GD 関数> <定義済み定数
Last updated: Fri, 05 Sep 2008
 
 
show source | credits | sitemap | contact | advertising | mirror sites