이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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,737
17년 전 조회 2,990
17년 전 조회 4,438
17년 전 조회 1,752
17년 전 조회 3,246
17년 전 조회 1,576
17년 전 조회 3,489
17년 전 조회 5,846
17년 전 조회 1,426
17년 전 조회 2,166
17년 전 조회 1,796
17년 전 조회 1,535
17년 전 조회 2,421
17년 전 조회 2,633
17년 전 조회 1,599
17년 전 조회 2,688
17년 전 조회 3,176
17년 전 조회 1,530
17년 전 조회 1,948
17년 전 조회 3,851
17년 전 조회 4,482
17년 전 조회 1,876
17년 전 조회 1,739
17년 전 조회 2,674
18년 전 조회 1,856
18년 전 조회 3,940
18년 전 조회 1,650
16년 전 조회 1,933
18년 전 조회 2,266
18년 전 조회 2,116
18년 전 조회 3,572
18년 전 조회 1,589
18년 전 조회 2,660
18년 전 조회 1,644
18년 전 조회 1,912
18년 전 조회 7,432
18년 전 조회 2,002
18년 전 조회 4,096
18년 전 조회 2,428
18년 전 조회 2,435
18년 전 조회 2,156
18년 전 조회 2,202
18년 전 조회 2,622
18년 전 조회 3,219
18년 전 조회 5,331
18년 전 조회 2,786
18년 전 조회 2,702
18년 전 조회 2,554
18년 전 조회 1,803
18년 전 조회 2,208
18년 전 조회 5,318
18년 전 조회 3,025
18년 전 조회 2,592
18년 전 조회 3,264
18년 전 조회 2,484
18년 전 조회 2,841
18년 전 조회 5,876
18년 전 조회 2,621
18년 전 조회 2,018
18년 전 조회 2,653
18년 전 조회 1,480
18년 전 조회 9,805
18년 전 조회 4,461
18년 전 조회 3,291
18년 전 조회 1,814
18년 전 조회 3,607
18년 전 조회 2,288
18년 전 조회 3,733
18년 전 조회 5,181
18년 전 조회 3,837
18년 전 조회 2,674
18년 전 조회 2,941
18년 전 조회 2,451
18년 전 조회 2,790
18년 전 조회 1,902
18년 전 조회 3,442
18년 전 조회 2,141
18년 전 조회 2,270
18년 전 조회 2,087
18년 전 조회 3,057
18년 전 조회 2,004
18년 전 조회 2,672
18년 전 조회 3,875
18년 전 조회 4,565
18년 전 조회 2,377
18년 전 조회 2,849
18년 전 조회 4,622
18년 전 조회 2,687
18년 전 조회 1,878
18년 전 조회 3,323
18년 전 조회 3,140
18년 전 조회 3,861
18년 전 조회 2,175
18년 전 조회 2,346
18년 전 조회 1만
18년 전 조회 3,512
18년 전 조회 3,303
18년 전 조회 3,183
18년 전 조회 2,805
18년 전 조회 4,157
🐛 버그신고