유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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,187건
+
제목 글쓴이 날짜 조회
08-11-25 조회 3,759
08-11-25 조회 2,950
08-11-25 조회 4,528
08-11-25 조회 4,400
08-11-21 조회 4,380
08-11-21 조회 5,311
08-11-20 조회 3,934
08-11-20 조회 3,749
08-11-19 조회 4,018
08-11-19 조회 4,260
08-11-18 조회 4,041
08-11-15 조회 2,919
08-11-14 조회 3,221
08-11-14 조회 2,887
08-11-14 조회 3,281
08-11-13 조회 3,907
08-11-12 조회 1만
08-11-07 조회 4,607
08-11-07 조회 5,594
08-11-03 조회 3,358
08-11-01 조회 5,071
08-11-01 조회 3,023
08-10-30 조회 2,730
08-10-30 조회 3,664
08-10-30 조회 2,761
08-10-30 조회 2,997
08-10-30 조회 2,858
08-10-29 조회 3,943
08-10-29 조회 2,921
08-10-29 조회 2,457
08-10-20 조회 2,584
08-10-18 조회 4,535
08-10-16 조회 3,585
08-10-16 조회 3,393
08-10-14 조회 2,591
08-10-11 조회 3,893
08-10-11 조회 2,492
08-10-09 조회 2,586
08-10-09 조회 2,742
08-10-09 조회 4,212
08-10-08 조회 3,906
08-10-02 조회 3,848
08-10-02 조회 2,595
08-10-02 조회 2,738
08-09-29 조회 4,670
08-09-29 조회 4,301
08-09-26 조회 5,617
08-09-26 조회 3,587
08-09-26 조회 3,653
08-09-26 조회 2,796
08-09-26 조회 3,840
08-09-26 조회 3,579
08-09-26 조회 4,340
08-09-22 조회 3,901
08-09-22 조회 3,085
08-09-22 조회 4,051
08-09-22 조회 3,009
08-09-22 조회 2,661
08-09-21 조회 3,649
08-09-20 조회 4,231
08-09-20 조회 5,501
08-09-20 조회 4,597
08-09-20 조회 2,915
08-09-20 조회 3,319
08-09-20 조회 3,684
08-09-20 조회 3,061
08-09-20 조회 3,253
08-09-20 조회 4,234
08-09-20 조회 3,736
08-09-20 조회 3,316
08-09-19 조회 5,713
08-09-19 조회 4,490
08-09-19 조회 2,801
08-09-18 조회 5,154
08-09-18 조회 4,233
08-09-18 조회 3,607
08-09-18 조회 2,805
08-09-18 조회 3,714
08-09-18 조회 3,508
08-09-17 조회 3,378
08-09-16 조회 3,323
08-09-10 조회 2,534
08-09-09 조회 3,337
08-09-06 조회 4,229
08-09-06 조회 2,783
08-09-06 조회 3,157
08-09-06 조회 2,822
08-09-06 조회 3,048
08-09-06 조회 2,932
08-09-06 조회 2,911
08-09-05 조회 3,910
08-09-05 조회 3,733
08-09-05 조회 3,559
08-09-05 조회 2,781
08-09-05 조회 3,809
08-09-05 조회 5,773
08-09-05 조회 4,225
08-09-05 조회 3,112
08-09-05 조회 3,267
08-09-05 조회 4,691