유

이미지에 박스 넣기

· 2008-01-15 (화) 16:26:22 · 3384 · 2

//이미지에 네모 박스 집어넣기
function draw_box(&$im, $x1, $y1, $x2, $y2, $line_color='', $box_color=''){

  if (!empty($line_color)) {

    $r = hexdec(substr($line_color, 1, 2));
    $g = hexdec(substr($line_color, 3, 2));
    $b = hexdec(substr($line_color, 5, 2));
    $line_color = imagecolorallocate($im, $r, $g, $b);
  }

  if (!empty($box_color)) {

    $r = hexdec(substr($box_color, 1, 2));
    $g = hexdec(substr($box_color, 3, 2));
    $b = hexdec(substr($box_color, 5, 2));
    $box_color = imagecolorallocate($im, $r, $g, $b);
  }

  if (!empty($box_color)) imagefilledrectangle($im, $x1, $y1, $x2, $y2, $box_color);

  if (!empty($line_color)) {

    imageline ($im , $x1, $y1 , $x2 , $y1 , $line_color );//윗줄
    imageline ($im , $x1 , $y2 , $x2 , $y2 , $line_color );//아랫줄
    imageline ($im , $x1 , $y1 , $x1 , $y2 , $line_color );//앞줄
    imageline ($im , $x2 , $y1 , $x2 , $y2 , $line_color );//뒷줄
  }
}

사용법
이미지 생성한후, 생성하는 방법은 여러가지가 있습니다.
$src = @imagecreatefromjpeg($src_path);

이미지에 30*30짜리 박스를 그리고
draw_box(&$src, 0, 0, 30, 30, '#000000', '#FFFFFF');

이미지 생성
imagejpeg($src, $copy_path, 90);

[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]
|

댓글 2개

도움이 많이 되었습니다..감사합니다.
감사합니당~
댓글을 작성하시려면 로그인이 필요합니다.

프로그램

8,188건
+
제목 글쓴이 날짜 조회
08-02-03 조회 2,750
09-10-03 조회 3,078
08-02-03 조회 3,362
08-02-03 조회 3,295
08-01-30 조회 4,794
08-01-29 조회 2,690
08-01-27 조회 3,810
08-01-27 조회 2,765
08-01-27 조회 3,052
08-01-26 조회 8,569
08-01-26 조회 3,169
08-01-24 조회 5,226
08-01-23 조회 3,566
08-01-21 조회 3,602
08-01-21 조회 3,337
08-01-21 조회 3,323
08-01-18 조회 3,838
08-01-18 조회 4,469
08-01-18 조회 6,623
08-01-18 조회 3,931
08-01-17 조회 3,919
08-01-17 조회 3,737
08-01-16 조회 2,986
08-01-15 조회 3,385
08-01-14 조회 6,635
08-01-12 조회 4,226
08-01-12 조회 3,803
08-01-12 조회 4,515
08-01-12 조회 3,741
08-01-12 조회 4,030
08-01-11 조회 7,067
08-01-10 조회 3,809
08-01-08 조회 3,353
08-01-08 조회 3,772
08-01-06 조회 2,587
08-01-04 조회 1.1만
08-01-02 조회 5,678
07-12-28 조회 4,621
07-12-24 조회 3,016
07-12-21 조회 4,712
07-12-17 조회 3,506
07-12-14 조회 4,866
07-12-13 조회 6,311
07-12-10 조회 4,972
07-12-10 조회 3,839
07-12-10 조회 4,170
07-12-08 조회 3,604
07-12-07 조회 3,952
07-12-07 조회 3,070
07-12-06 조회 4,812
07-12-04 조회 3,378
07-12-04 조회 3,495
07-12-03 조회 3,256
07-12-03 조회 4,299
07-12-02 조회 3,116
07-11-30 조회 3,877
07-11-30 조회 5,105
07-11-30 조회 5,717
07-11-29 조회 3,554
07-11-27 조회 4,008
07-11-27 조회 5,793
07-11-27 조회 3,911
07-11-26 조회 3,003
07-11-23 조회 4,506
07-11-23 조회 4,239
07-11-22 조회 5,120
07-11-21 조회 3,329
07-11-21 조회 3,480
07-11-21 조회 1.1만
07-11-20 조회 4,870
07-11-16 조회 4,708
07-11-13 조회 4,365
07-11-12 조회 4,075
07-11-10 조회 5,448
07-11-08 조회 6,636
07-11-08 조회 4,928
07-11-07 조회 4,387
07-11-07 조회 4,842
07-11-06 조회 3,415
07-11-06 조회 3,796
07-11-05 조회 5,135
07-11-02 조회 4,015
07-11-01 조회 5,477
07-10-31 조회 3,176
07-10-30 조회 3,624
07-10-29 조회 3,587
07-10-26 조회 4,947
07-10-25 조회 5,002
07-10-25 조회 3,820
07-10-24 조회 3,796
07-10-24 조회 4,103
07-10-24 조회 3,991
07-10-24 조회 3,268
07-10-24 조회 3,374
07-10-23 조회 5,990
07-10-23 조회 5,370
07-10-22 조회 4,126
07-10-22 조회 3,505
07-10-22 조회 4,046
07-10-22 조회 3,650