유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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-04-17 조회 5,686
08-04-17 조회 3,828
08-04-17 조회 8,820
08-04-17 조회 5,296
08-04-17 조회 5,511
08-04-17 조회 3,749
08-04-17 조회 4,501
08-04-17 조회 5,045
08-04-17 조회 5,397
08-04-17 조회 4,618
08-04-17 조회 4,615
08-04-17 조회 4,745
08-04-17 조회 3,826
08-04-17 조회 3,397
08-04-17 조회 4,408
08-04-17 조회 4,663
08-04-17 조회 6,073
08-04-17 조회 2,875
08-04-17 조회 4,053
08-04-17 조회 4,064
08-04-17 조회 3,277
08-04-17 조회 3,608
08-04-17 조회 3,223
08-04-17 조회 3,704
08-04-17 조회 5,063
08-04-17 조회 5,209
08-04-17 조회 3,414
08-04-16 조회 2,563
08-04-15 조회 2,691
08-04-14 조회 2,843
08-04-14 조회 2,826
08-04-11 조회 2,607
08-04-11 조회 2,741
08-04-11 조회 2,560
08-04-09 조회 3,170
08-04-08 조회 4,195
08-04-07 조회 3,106
08-04-07 조회 2,678
08-04-06 조회 2,944
08-04-06 조회 3,653
08-04-05 조회 3,234
08-04-05 조회 2,489
08-04-04 조회 7,292
08-04-04 조회 4,673
08-04-04 조회 4,576
08-04-04 조회 3,911
08-04-04 조회 4,117
08-04-04 조회 4,122
08-04-04 조회 4,578
08-04-04 조회 3,778
08-04-04 조회 3,917
08-04-04 조회 4,021
08-04-04 조회 3,955
08-04-04 조회 4,138
08-04-04 조회 4,674
08-04-04 조회 4,084
08-04-04 조회 2,918
08-04-04 조회 4,299
08-04-04 조회 3,007
08-04-04 조회 2,900
08-04-04 조회 3,393
08-04-04 조회 2,920
08-04-04 조회 2,797
08-04-04 조회 2,777
08-04-04 조회 3,003
08-04-04 조회 3,468
08-04-04 조회 2,809
08-04-04 조회 2,825
08-04-04 조회 2,645
08-04-04 조회 2,823
08-04-04 조회 2,652
08-04-04 조회 2,718
08-04-04 조회 3,045
08-04-04 조회 2,878
08-04-04 조회 2,744
08-04-04 조회 2,708
08-04-04 조회 2,784
08-04-04 조회 2,611
08-04-04 조회 2,654
08-04-04 조회 2,686
08-04-04 조회 2,755
08-04-04 조회 2,775
08-04-04 조회 2,861
08-04-04 조회 2,768
08-04-04 조회 3,126
08-04-04 조회 4,263
08-04-03 조회 4,686
08-04-03 조회 2,774
08-04-03 조회 2,909
08-04-03 조회 2,693
08-04-03 조회 3,552
08-04-03 조회 4,382
08-04-03 조회 2,659
08-04-03 조회 2,571
08-04-03 조회 2,821
08-04-03 조회 2,753
08-04-03 조회 2,916
08-04-03 조회 2,890
08-04-03 조회 2,768
08-04-03 조회 4,023