이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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,739
17년 전 조회 2,992
17년 전 조회 4,440
17년 전 조회 1,753
17년 전 조회 3,250
17년 전 조회 1,576
17년 전 조회 3,491
17년 전 조회 5,847
17년 전 조회 1,426
17년 전 조회 2,166
17년 전 조회 1,797
17년 전 조회 1,538
17년 전 조회 2,422
17년 전 조회 2,635
17년 전 조회 1,599
17년 전 조회 2,689
17년 전 조회 3,178
17년 전 조회 1,532
17년 전 조회 1,949
17년 전 조회 3,851
17년 전 조회 4,484
17년 전 조회 1,879
17년 전 조회 1,739
18년 전 조회 2,676
18년 전 조회 1,859
18년 전 조회 3,943
18년 전 조회 1,652
16년 전 조회 1,934
18년 전 조회 2,266
18년 전 조회 2,118
18년 전 조회 3,574
18년 전 조회 1,589
18년 전 조회 2,661
18년 전 조회 1,644
18년 전 조회 1,914
18년 전 조회 7,434
18년 전 조회 2,004
18년 전 조회 4,097
18년 전 조회 2,429
18년 전 조회 2,437
18년 전 조회 2,158
18년 전 조회 2,203
18년 전 조회 2,622
18년 전 조회 3,220
18년 전 조회 5,332
18년 전 조회 2,788
18년 전 조회 2,702
18년 전 조회 2,555
18년 전 조회 1,805
18년 전 조회 2,211
18년 전 조회 5,320
18년 전 조회 3,030
18년 전 조회 2,593
18년 전 조회 3,266
18년 전 조회 2,486
18년 전 조회 2,841
18년 전 조회 5,876
18년 전 조회 2,622
18년 전 조회 2,019
18년 전 조회 2,654
18년 전 조회 1,482
18년 전 조회 9,806
18년 전 조회 4,462
18년 전 조회 3,293
18년 전 조회 1,816
18년 전 조회 3,607
18년 전 조회 2,291
18년 전 조회 3,734
18년 전 조회 5,182
18년 전 조회 3,838
18년 전 조회 2,675
18년 전 조회 2,941
18년 전 조회 2,452
18년 전 조회 2,791
18년 전 조회 1,902
18년 전 조회 3,444
18년 전 조회 2,142
18년 전 조회 2,270
18년 전 조회 2,088
18년 전 조회 3,058
18년 전 조회 2,005
18년 전 조회 2,672
18년 전 조회 3,876
18년 전 조회 4,569
18년 전 조회 2,379
18년 전 조회 2,849
18년 전 조회 4,623
18년 전 조회 2,689
18년 전 조회 1,879
18년 전 조회 3,325
18년 전 조회 3,142
18년 전 조회 3,866
18년 전 조회 2,175
18년 전 조회 2,346
18년 전 조회 1만
18년 전 조회 3,512
18년 전 조회 3,305
18년 전 조회 3,186
18년 전 조회 2,808
18년 전 조회 4,160
🐛 버그신고