* button.php

<?php
header("Content-type: image/png");
$string = $_GET['text'];
$im = imagecreatefrompng("button.png");
$orange = imagecolorallocate($im, 60, 87, 156); // 60,87,156은 RGB값
$px = (imagesx($im) - 7.5 * strlen($string)) / 2; // 7.5는 한글자의 폭
imagestring($im, 4, $px, 9, $string, $orange); // 4는 폰트종류, $px는 x축, 9는 y축
imagepng($im);
imagedestroy($im);
?>

* 이미지 실시간 표시

<html>
<body>
	<img src="button.php?text=intro" />
	<img src="button.php?text=member" />
	<img src="button.php?text=history" />
	<img src="button.php?text=mission" />
</body>
</html>
출처 : https://opentutorials.org/course/62/5137

 

'php, codeigniter' 카테고리의 다른 글

php 버전업으로 인한 기존 globals의 $_FILES  (0) 2015.01.13
워터마크(watermark) 찍기  (0) 2015.01.12
utf-8 글자 자르기  (0) 2015.01.02
코드이그나이터 : IIS에서 index.php 지우기  (0) 2014.12.26
요일 구하기  (0) 2014.12.24
블로그 이미지

디츠

“말은 쉽지, 코드를 보여줘.” “Talk is cheap. Show me the code.” – 리누스 토르발스(Linus Torvalds)

,