1 / 9

PHP 의 GD

PHP 의 GD. >> 목 표 << . PHP 의 동적 이미지 생성방법. PHP 에서의 GD 라이브러리. 웹 그래픽 고정 이미지 (GIF, JPEG) 동적 이미지 디자인 (swf) 프로그래밍에 의한 이미지 생성 (PHP) GD 라이브러리 ANSI C 로 만들어진 대표적인 동적인 이미지 생성 도구 JPEG, PNG 포맷 지원 GD 라이브러리 공식 사이트 http://www.boutell.com/gd/ 이용하려면 ?

Télécharger la présentation

PHP 의 GD

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PHP의 GD >> 목 표 << . PHP의 동적 이미지 생성방법

  2. PHP에서의 GD 라이브러리 • 웹 그래픽 • 고정 이미지 (GIF, JPEG) • 동적 이미지 디자인 (swf) • 프로그래밍에 의한 이미지 생성 (PHP) • GD 라이브러리 • ANSI C로 만들어진 대표적인 동적인 이미지 생성 도구 • JPEG, PNG 포맷 지원 • GD 라이브러리 공식 사이트 • http://www.boutell.com/gd/ • 이용하려면? • C:\php\ext\ 폴더에 php_gd.dll과 php_gd2.dll • php.ini 파일의 수정 • extension = php_gd.dll or extension = php_gd2.dll

  3. GD 라이브러리를 위한 PHP함수 • http://conep.sunchon.ac.kr/courseware/image.htm

  4. GD 생성해보기 • PHP 이미지 생성의 기본 원리 • 설계할 이미지 구상 • HTTP 헤더를 정의 • 빈 이미지를 메모리에 생성 • 원하는 이미지 표현(생성) • 화면 또는 파일에 저장 • 메모리에 있는 이미지 해제 Header(“Content-type: image/png”); Memory

  5. 예 제 <?php header("Content-type: image/jpeg"); // 헤더 // 빈 이미지 생성 $img = imagecreate(200, 200) or die ("GD 생성에 실패했습니다"); // 기타 설정 $white = imagecolorallocate($img, 255, 255, 255); $black = imagecolorallocate($img, 0, 0, 0); $red = imagecolorallocate($img, 255,0 , 0); // 원하는 이미지 표현 (생성) imagefilledellipse($img, 100, 100, 100, 100, $red); imageellipse($img, 100, 100, 100, 100, $black); imageline($img, 100, 50, 100, 150, $black); imageline($img, 100,150, 200, 150, $black); imageline($img, 200, 150, 100, 50, $black); imagepng($img); // 화면에 출력하기 (png) imagedestroy($img); // 메모리에서 이미지 해제 ?>

  6. GD에서의 좌표 기준은?

  7. 다이나믹 버튼 함수 http://conep.sunchon.ac.kr/php/gd/dbutton.htm //<?php function create_button ($text, $filename, $url) { $img = imagecreate(80, 20); // 빈 이미지 생성 $white = imagecolorallocate($img, 255, 255,255); // 컬러 설정 $black = imagecolorallocate($img, 0,0,0); $red = imagecolorallocate($img, 255,0,0); imagerectangle($img,1,1, #, #,$red); // 사각형 그리기 $fontsize = #; $textbox = imagettfbbox($fontsize,0,"verdana.ttf", $text); // 폰트 설정 $x1 = imagesx($img); $y1 = imagesy($img); $x2 = $textbox[4] - $textbox[6]; $y2 = $textbox[1] - $textbox[7]; $x = ($x1 - $x2) / 2; $y = $y1-(($y1 - $y2)/2); imagettftext($img, #, 0, #, #, #, #, #); imagepng($img, $filename); echo "<a href='$url'><img src = # border='0'></a>"; imagedestroy(#); // 이미지를 메모리에서 해제 } //?>

  8. 레포트 • 목적 • 동적 이미지 생성으로 오른쪽 결과를 얻는다. • 조건 • 각 이미지 • 하이퍼링크가 설정됨 • 방법 • 이미지 함수의 쓰임을 정리 • php 함수의 활용 이해하기 • 점수 • 3점: 코드 이해 및 php함수 이용 • 2점: 코드 변형 • 5점: 가변길이에 따른 이미지 생성 • 기한 • 11월 23일까지 이메일(whso@sunchon.ac.kr)

  9. 1) 프로젝트의 기능모델을 그리고 간단히 설명하시오. - 먼저 본인의 프로젝트의 기능을 나열하여 관계를 표시하고 설명하시오. 2) 기능 모델의 어느 부분을 어떻게 구현하였습니까? • PHP 프로그램과 MySQL 활용관점에서 간단히 설명하시오. 3) 본인의 프로젝트 수행 목적이 무엇이며 어떤 기능들이 그 목적을 달성하였습니까? 4) 구현한 기능 중에서 창의적인 기능은 무엇이며 어떤 방법을 사용하였습니까?

More Related