<!--img.php-->
<html>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<body>
<img src="imgtest2.php?price=9000">
</body>
</html>
<!--끝-->
<!--imgtest2.php-->
<?php
header('Content-Type: image/png');
$im = imagecreatetruecolor(400, 30); // 이미지 사이즈 400*30
$white = imagecolorallocate($im, 255, 255, 255); // 흰색
$gray = imagecolorallocate($im, 128, 128, 128); // 회색
$black = imagecolorallocate($im, 0, 0, 0); // 검정색
imagefilledrectangle($im, 0, 0, 399, 29, $white); // 바탕색 흰색으로 채우기
$text = number_format($_GET["price"]); // 숫자에 , 찍어주기?
$font = 'ARIAL.TTF'; // 폰트 파일이 이 파일하고 같은 위치에 있어야 됨.
imagettftext($im, 20, 0, 11, 21, $gray, $font, $text); // 글씨쓰기 폰트사이트 20, 각도 0, X위치 11, Y위치 21
imagettftext($im, 20, 0, 10, 20, $black, $font, $text); // 글씨쓰기 폰트사이트 20, 각도 0, X위치 11, Y위치 21
imagepng($im);
imagedestroy($im);
?>
<!--끝-->
[출처] phpschool.com
'웹프로그래밍 > PHP' 카테고리의 다른 글
[php] 썸네일 작성시 주의할점. (0) | 2012.11.26 |
---|---|
[PHP] 컬럼명(필드명) 가져오기 (0) | 2012.04.27 |
[PHP] 게시판 악성스크립트 방지 (1) | 2012.04.25 |
[PHP] 세션정보 읽어오기 (0) | 2012.04.11 |
[PHP] 게시판글쓰기에 사용되는 난수이미지 만들기 (0) | 2012.04.11 |