유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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,685
08-10-30 조회 2,783
08-10-20 조회 2,512
08-10-11 조회 2,419
08-09-20 조회 4,162
08-09-20 조회 2,827
08-09-18 조회 2,696
08-09-18 조회 3,408
08-09-17 조회 3,278
08-09-05 조회 4,618
08-09-03 조회 2,736
08-08-18 조회 2,879
08-08-17 조회 2,624
08-08-13 조회 3,399
08-07-30 조회 3,463
08-07-28 조회 4,340
08-07-22 조회 5,570
08-07-22 조회 4,055
08-07-10 조회 3,021
08-07-08 조회 3,087
08-06-30 조회 3,848
08-06-30 조회 3,335
08-06-30 조회 3,646
08-06-14 조회 2,709
08-06-11 조회 7,078
08-06-05 조회 3,297
08-05-20 조회 4,808
08-05-13 조회 4,142
08-05-08 조회 3,096
08-05-08 조회 5,254
08-04-25 조회 4,050
08-04-22 조회 4,513
08-04-21 조회 3,161
08-04-17 조회 2,540
08-04-17 조회 2,940
08-04-17 조회 2,239
08-04-17 조회 5,205
08-04-17 조회 4,528
08-04-17 조회 4,520
08-04-17 조회 3,300
08-04-17 조회 3,124
08-04-17 조회 3,618
08-04-17 조회 4,980
08-04-17 조회 5,130
08-04-17 조회 3,342
08-04-04 조회 4,582
08-04-04 조회 2,815
08-04-04 조회 2,558
08-04-04 조회 2,789
08-04-04 조회 2,530
08-04-04 조회 2,762
08-04-03 조회 2,650
08-04-03 조회 2,721
08-04-02 조회 3,034
08-04-02 조회 3,185
08-03-31 조회 3,083
08-03-26 조회 4,251
08-03-11 조회 2,942
08-03-11 조회 2,358
08-03-11 조회 2,363
08-03-07 조회 4,193
08-03-07 조회 3,290
08-03-06 조회 4,730
08-03-04 조회 3,373
08-02-19 조회 3,772
08-02-03 조회 3,394
08-01-18 조회 3,973
08-01-15 조회 3,430
08-01-12 조회 4,276
08-01-12 조회 3,844
08-01-12 조회 3,792
07-12-24 조회 3,082
07-11-30 조회 3,923
07-11-08 조회 4,985
07-11-06 조회 3,833
07-10-26 조회 4,980
07-10-24 조회 4,165
07-10-22 조회 3,560
07-10-19 조회 4,739
07-10-09 조회 4,872
07-10-09 조회 6,741
07-10-05 조회 3,072
07-10-05 조회 4,009
07-10-03 조회 7,517
07-10-03 조회 3,567
07-10-03 조회 2,904
07-10-03 조회 2,837
07-09-28 조회 4,674
07-09-27 조회 3,743
07-09-27 조회 3,197
07-09-13 조회 3,341
07-08-28 조회 3,433
07-08-04 조회 4,818
07-08-01 조회 5,518
07-08-01 조회 4,925
07-07-30 조회 5,426
07-07-29 조회 3,571
07-07-21 조회 3,407
07-07-18 조회 5,364
07-07-16 조회 3,169