1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
<?xml version="1.0" encoding="utf-8"?>
<!-- edited with XML Spy v2.5 NT - http://www.xmlspy.com -->
<chapter id="features.images">
<title>PHP에서 이미지 생성과 수정(Creating and manipulating images)</title>
<simpara>
PHP는 단지 HTML출력을 만드는 것만 할 수 있는 것이 아니다.
PHP는 GIF image file도 만들 수 있을 있을 뿐아니라,
사용하기에 편리한 GIF image stream까지 만들 수 있다.
이를 위해서 여러분은 PHP를 컴파일 할 때, image 함수를 가지고 있는 GD 라이브러리를 포함하여야 한다.
GD와 PHP는 사용하는 이미지 포맷 형태에 따라 다른 라이브러리도 요구한다.
GD는 버전 1.6부터 GIF 이미지 지원을 하지 않는다.
</simpara>
<para>
<example>
<title>PNG creation with PHP</title>
<programlisting role="php">
<?php
Header("Content-type: image/png");
$string=implode($argv," ");
$im = imageCreateFromPng("images/button1.png");
$orange = ImageColorAllocate($im, 220, 210, 60);
$px = (imagesx($im)-7.5*strlen($string))/2;
ImageString($im,3,$px,9,$string,$orange);
ImagePng($im);
ImageDestroy($im);
?>
</programlisting>
</example>
위의 예제는 <img src="button.php?text"> 와 같은 tag이 있는 페이지로부터 불려지게 될 것이다.
그러면 위에있는 button.php 스크립트는 "text"라는 문자열을
"images/button1.gif"에 오버레이 시켜 결과 image에 출력한다.
이렇게 하면 버튼에 들어가는 글씨를 매번 손쉽게 바꿔 쓸 수 있고,
또한 매번 이미지 파일을 만들 필요가 없어 효율적이고 간단하다.
</para>
</chapter>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
|