유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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,188건
+
제목 글쓴이 날짜 조회
08-10-30 조회 2,694
08-10-30 조회 2,791
08-10-20 조회 2,522
08-10-11 조회 2,423
08-09-20 조회 4,168
08-09-20 조회 2,836
08-09-18 조회 2,712
08-09-18 조회 3,417
08-09-17 조회 3,283
08-09-05 조회 4,627
08-09-03 조회 2,750
08-08-18 조회 2,890
08-08-17 조회 2,627
08-08-13 조회 3,409
08-07-30 조회 3,469
08-07-28 조회 4,347
08-07-22 조회 5,579
08-07-22 조회 4,059
08-07-10 조회 3,031
08-07-08 조회 3,094
08-06-30 조회 3,854
08-06-30 조회 3,340
08-06-30 조회 3,655
08-06-14 조회 2,720
08-06-11 조회 7,087
08-06-05 조회 3,303
08-05-20 조회 4,818
08-05-13 조회 4,152
08-05-08 조회 3,105
08-05-08 조회 5,261
08-04-25 조회 4,059
08-04-22 조회 4,523
08-04-21 조회 3,166
08-04-17 조회 2,549
08-04-17 조회 2,947
08-04-17 조회 2,249
08-04-17 조회 5,215
08-04-17 조회 4,537
08-04-17 조회 4,527
08-04-17 조회 3,311
08-04-17 조회 3,137
08-04-17 조회 3,626
08-04-17 조회 4,985
08-04-17 조회 5,137
08-04-17 조회 3,345
08-04-04 조회 4,597
08-04-04 조회 2,823
08-04-04 조회 2,568
08-04-04 조회 2,799
08-04-04 조회 2,538
08-04-04 조회 2,771
08-04-03 조회 2,663
08-04-03 조회 2,726
08-04-02 조회 3,045
08-04-02 조회 3,196
08-03-31 조회 3,091
08-03-26 조회 4,264
08-03-11 조회 2,952
08-03-11 조회 2,361
08-03-11 조회 2,371
08-03-07 조회 4,204
08-03-07 조회 3,298
08-03-06 조회 4,749
08-03-04 조회 3,386
08-02-19 조회 3,780
08-02-03 조회 3,403
08-01-18 조회 3,985
08-01-15 조회 3,440
08-01-12 조회 4,288
08-01-12 조회 3,851
08-01-12 조회 3,802
07-12-24 조회 3,095
07-11-30 조회 3,931
07-11-08 조회 4,991
07-11-06 조회 3,851
07-10-26 조회 4,995
07-10-24 조회 4,181
07-10-22 조회 3,569
07-10-19 조회 4,749
07-10-09 조회 4,885
07-10-09 조회 6,750
07-10-05 조회 3,083
07-10-05 조회 4,017
07-10-03 조회 7,528
07-10-03 조회 3,571
07-10-03 조회 2,922
07-10-03 조회 2,850
07-09-28 조회 4,694
07-09-27 조회 3,758
07-09-27 조회 3,208
07-09-13 조회 3,353
07-08-28 조회 3,447
07-08-04 조회 4,833
07-08-01 조회 5,522
07-08-01 조회 4,933
07-07-30 조회 5,440
07-07-29 조회 3,584
07-07-21 조회 3,419
07-07-18 조회 5,373
07-07-16 조회 3,176