유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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-10-19 조회 3,466
07-10-19 조회 3,226
07-10-19 조회 3,175
07-10-19 조회 2,877
07-10-19 조회 4,454
07-10-19 조회 5,819
07-10-19 조회 6,101
07-10-19 조회 3,486
07-10-19 조회 4,948
07-10-17 조회 4,599
07-10-17 조회 5,986
07-10-16 조회 4,610
07-10-15 조회 5,573
07-10-13 조회 5,248
07-10-09 조회 4,951
07-10-09 조회 4,286
07-10-09 조회 4,215
07-10-09 조회 4,772
07-10-09 조회 3,537
07-10-09 조회 3,319
07-10-09 조회 6,794
07-10-09 조회 3,945
07-10-09 조회 3,678
07-10-09 조회 3,999
07-10-09 조회 3,370
07-10-09 조회 4,409
07-10-08 조회 1.1만
07-10-05 조회 3,156
07-10-05 조회 4,080
07-10-03 조회 4,196
07-10-03 조회 3,400
07-10-03 조회 4,244
07-10-03 조회 5,263
07-10-03 조회 4,246
07-10-03 조회 3,646
07-10-03 조회 7,333
07-10-03 조회 4,914
07-10-03 조회 7,584
07-10-03 조회 3,681
07-10-03 조회 3,625
07-10-03 조회 3,630
07-10-03 조회 4,665
07-10-03 조회 4,621
07-10-03 조회 3,317
07-10-03 조회 5,178
07-10-03 조회 2,983
07-10-03 조회 2,652
07-10-03 조회 2,701
07-10-03 조회 2,910
07-10-03 조회 2,918
07-10-03 조회 4,735
07-10-02 조회 3,623
07-10-02 조회 3,155
07-10-02 조회 3,491
07-10-02 조회 5,796
07-10-02 조회 3,529
07-10-02 조회 4,155
07-10-02 조회 3,169
07-10-02 조회 4,835
07-10-02 조회 3,079
07-10-02 조회 8,913
07-10-02 조회 4,570
07-10-01 조회 2,534
07-10-01 조회 3,731
07-09-28 조회 4,757
07-09-28 조회 3,628
07-09-27 조회 3,528
07-09-27 조회 4,037
07-09-27 조회 5,079
07-09-27 조회 4,683
07-09-27 조회 3,818
07-09-27 조회 3,228
07-09-27 조회 3,282
07-09-27 조회 3,918
07-09-27 조회 3,253
07-09-15 조회 4,193
07-09-15 조회 2,909
07-09-13 조회 3,430
07-09-13 조회 2,951
07-09-13 조회 3,388
07-09-11 조회 3,621
07-09-09 조회 3,555
07-08-28 조회 3,497
07-08-28 조회 3,372
07-08-23 조회 4,676
07-08-22 조회 2,871
07-08-21 조회 4,655
07-08-21 조회 3,239
07-08-16 조회 6,510
07-08-07 조회 3,416
07-08-04 조회 3,543
07-08-04 조회 2,914
07-08-04 조회 3,326
07-08-04 조회 4,883
07-08-04 조회 2,728
07-08-04 조회 2,934
07-08-01 조회 5,570
07-08-01 조회 4,984
07-07-31 조회 4,448
07-07-31 조회 4,697