유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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건
+
제목 글쓴이 날짜 조회
07-05-09 조회 3,515
07-05-09 조회 5,457
07-05-09 조회 3,541
07-05-09 조회 4,603
07-05-09 조회 6,153
07-05-08 조회 3,207
07-05-08 조회 4,564
07-05-08 조회 2,895
07-05-08 조회 3,940
07-05-07 조회 2,951
07-05-05 조회 3,986
07-05-04 조회 3,815
07-05-04 조회 2,810
07-05-04 조회 2,749
07-05-04 조회 2,970
07-05-04 조회 3,544
07-05-04 조회 3,306
07-05-04 조회 3,642
07-05-04 조회 6,240
07-05-04 조회 3,007
07-05-04 조회 2,433
07-05-04 조회 2,535
07-05-04 조회 2,510
07-05-04 조회 2,253
07-05-04 조회 2,209
07-05-04 조회 2,568
07-05-04 조회 2,540
07-05-04 조회 3,496
07-05-04 조회 2,412
07-05-04 조회 2,803
07-05-04 조회 3,319
07-05-04 조회 2,452
07-05-04 조회 4,037
07-05-04 조회 2,505
07-05-04 조회 2,881
07-05-04 조회 2,703
07-05-04 조회 2,609
07-05-04 조회 2,439
07-05-04 조회 2,283
07-05-04 조회 2,905
07-05-04 조회 2,290
07-05-04 조회 4,879
07-05-04 조회 2,930
07-05-02 조회 3,019
07-05-02 조회 2,329
07-05-02 조회 3,054
07-05-02 조회 2,286
07-05-02 조회 2,348
07-05-02 조회 2,189
07-05-02 조회 2,157
07-05-02 조회 2,244
07-05-02 조회 3,773
07-05-01 조회 2,728
07-05-01 조회 2,833
07-05-01 조회 2,394
07-05-01 조회 3,076
07-05-01 조회 2,724
07-05-01 조회 2,695
07-05-01 조회 2,913
07-05-01 조회 2,184
07-05-01 조회 2,623
07-05-01 조회 3,496
07-05-01 조회 2,349
07-05-01 조회 2,530
07-05-01 조회 2,762
07-05-01 조회 2,364
07-05-01 조회 2,170
07-05-01 조회 2,377
07-05-01 조회 2,723
07-05-01 조회 2,846
07-05-01 조회 2,780
07-05-01 조회 2,400
07-04-30 조회 9,882
07-04-30 조회 3,197
07-04-30 조회 2,739
07-04-30 조회 2,699
07-04-30 조회 3,040
07-04-30 조회 3,112
07-04-30 조회 2,465
07-04-30 조회 2,209
07-04-30 조회 4,024
07-04-30 조회 4,414
07-04-30 조회 3,459
07-04-30 조회 2,867
07-04-30 조회 2,681
07-04-30 조회 2,112
07-04-28 조회 3,051
07-04-28 조회 6,587
07-04-27 조회 4,156
07-04-27 조회 3,489
07-04-27 조회 4,389
07-04-26 조회 3,794
07-04-26 조회 3,498
07-04-26 조회 5,809
07-04-26 조회 4,798
07-04-25 조회 4,807
07-04-25 조회 5,345
07-04-25 조회 3,230
07-04-22 조회 2,998
07-04-22 조회 2,998