유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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-07-30 조회 5,130
07-07-30 조회 5,593
07-07-30 조회 5,517
07-07-29 조회 3,925
07-07-29 조회 3,658
07-07-29 조회 4,606
07-07-29 조회 4,466
07-07-28 조회 4,666
07-07-26 조회 4,582
07-07-25 조회 6,234
07-07-24 조회 6,491
07-07-21 조회 4,605
07-07-21 조회 3,960
07-07-21 조회 4,167
07-07-21 조회 3,479
07-07-21 조회 3,314
07-07-21 조회 3,260
07-07-20 조회 4,366
07-07-20 조회 3,508
07-07-20 조회 3,584
07-07-20 조회 3,258
07-07-20 조회 3,715
07-07-20 조회 4,447
07-07-18 조회 5,430
07-07-18 조회 4,628
07-07-16 조회 3,228
07-07-16 조회 3,151
07-07-13 조회 4,128
07-07-12 조회 2,844
07-07-09 조회 3,238
07-07-07 조회 3,476
07-07-07 조회 3,377
07-07-07 조회 3,501
07-07-06 조회 5,318
07-07-06 조회 3,045
07-07-06 조회 5,737
07-07-06 조회 4,295
07-07-06 조회 3,477
07-07-06 조회 4,520
07-07-06 조회 4,140
07-07-05 조회 4,126
07-07-05 조회 6,881
07-07-04 조회 3,497
07-07-02 조회 4,654
07-06-30 조회 4,535
07-06-29 조회 4,934
07-06-29 조회 4,464
07-06-28 조회 3,651
07-06-23 조회 3,307
07-06-21 조회 3,772
07-06-20 조회 7,440
07-06-20 조회 4,050
07-06-20 조회 5,788
07-06-19 조회 3,242
07-06-19 조회 1.1만
07-06-17 조회 3,706
07-06-16 조회 2,810
07-06-15 조회 4,214
07-06-12 조회 4,169
07-06-11 조회 4,048
07-06-11 조회 3,338
07-06-05 조회 3,680
07-06-05 조회 4,233
07-06-05 조회 4,243
07-06-05 조회 5,348
07-06-04 조회 7,411
07-05-31 조회 3,321
07-05-30 조회 3,392
07-05-29 조회 3,089
07-05-29 조회 2,818
07-05-29 조회 3,831
07-05-29 조회 2,913
07-05-29 조회 2,724
07-05-29 조회 5,965
07-05-29 조회 2,979
07-05-29 조회 3,007
07-05-29 조회 3,016
07-05-29 조회 3,128
07-05-29 조회 4,818
07-05-29 조회 2,816
07-05-29 조회 2,680
07-05-29 조회 2,498
07-05-29 조회 3,046
07-05-29 조회 3,084
07-05-28 조회 5,010
07-05-26 조회 3,299
07-05-20 조회 4,330
07-05-18 조회 6,075
07-05-18 조회 4,126
07-05-17 조회 9,243
07-05-17 조회 5,285
07-05-17 조회 3,954
07-05-16 조회 2,697
07-05-16 조회 3,841
07-05-15 조회 6,268
07-05-14 조회 6,447
07-05-13 조회 3,285
07-05-11 조회 5,596
07-05-10 조회 5,338
07-05-10 조회 5,408