이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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개

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

프로그램

+
제목 글쓴이 날짜 조회
17년 전 조회 1,731
17년 전 조회 2,985
17년 전 조회 4,431
17년 전 조회 1,747
17년 전 조회 3,240
17년 전 조회 1,571
17년 전 조회 3,484
17년 전 조회 5,841
17년 전 조회 1,425
17년 전 조회 2,158
17년 전 조회 1,789
17년 전 조회 1,531
17년 전 조회 2,418
17년 전 조회 2,630
17년 전 조회 1,594
17년 전 조회 2,683
17년 전 조회 3,172
17년 전 조회 1,527
17년 전 조회 1,942
17년 전 조회 3,846
17년 전 조회 4,477
17년 전 조회 1,870
17년 전 조회 1,732
17년 전 조회 2,670
17년 전 조회 1,850
17년 전 조회 3,937
17년 전 조회 1,644
16년 전 조회 1,928
17년 전 조회 2,261
17년 전 조회 2,109
18년 전 조회 3,567
18년 전 조회 1,586
18년 전 조회 2,657
18년 전 조회 1,638
18년 전 조회 1,907
18년 전 조회 7,427
18년 전 조회 1,998
18년 전 조회 4,089
18년 전 조회 2,422
18년 전 조회 2,433
18년 전 조회 2,152
18년 전 조회 2,196
18년 전 조회 2,618
18년 전 조회 3,216
18년 전 조회 5,325
18년 전 조회 2,780
18년 전 조회 2,698
18년 전 조회 2,546
18년 전 조회 1,797
18년 전 조회 2,204
18년 전 조회 5,311
18년 전 조회 3,022
18년 전 조회 2,587
18년 전 조회 3,258
18년 전 조회 2,480
18년 전 조회 2,835
18년 전 조회 5,866
18년 전 조회 2,617
18년 전 조회 2,011
18년 전 조회 2,645
18년 전 조회 1,475
18년 전 조회 9,797
18년 전 조회 4,456
18년 전 조회 3,283
18년 전 조회 1,810
18년 전 조회 3,601
18년 전 조회 2,280
18년 전 조회 3,728
18년 전 조회 5,178
18년 전 조회 3,831
18년 전 조회 2,673
18년 전 조회 2,938
18년 전 조회 2,446
18년 전 조회 2,785
18년 전 조회 1,899
18년 전 조회 3,437
18년 전 조회 2,139
18년 전 조회 2,266
18년 전 조회 2,083
18년 전 조회 3,050
18년 전 조회 1,999
18년 전 조회 2,666
18년 전 조회 3,869
18년 전 조회 4,564
18년 전 조회 2,373
18년 전 조회 2,844
18년 전 조회 4,616
18년 전 조회 2,683
18년 전 조회 1,872
18년 전 조회 3,319
18년 전 조회 3,136
18년 전 조회 3,858
18년 전 조회 2,170
18년 전 조회 2,341
18년 전 조회 1만
18년 전 조회 3,504
18년 전 조회 3,299
18년 전 조회 3,179
18년 전 조회 2,801
18년 전 조회 4,153
🐛 버그신고