이미지에 박스 넣기

· 2008-01-15 (화) 16:26:22 · 3375 · 2

//이미지에 네모 박스 집어넣기
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-04-17 조회 4,292
08-03-14 조회 3,192
08-03-08 조회 3,011
08-03-06 조회 2,984
08-03-03 조회 4,274
08-02-20 조회 2,961
08-02-15 조회 3,875
08-02-11 조회 5,034
08-02-09 조회 5,722
08-02-05 조회 3,808
08-01-14 조회 6,622
08-01-11 조회 7,052
08-01-04 조회 1.1만
07-12-10 조회 4,960
07-12-10 조회 3,824
07-12-04 조회 3,359
07-11-29 조회 3,541
07-11-27 조회 3,900
07-11-23 조회 4,495
07-11-23 조회 4,227
07-11-13 조회 4,356
07-10-19 조회 4,810
07-10-17 조회 5,863
07-10-03 조회 4,899
07-10-02 조회 8,791
07-10-02 조회 4,450
07-09-09 조회 3,415
07-07-29 조회 4,293
07-07-28 조회 4,524
07-07-26 조회 4,431
07-06-19 조회 1.1만
07-06-17 조회 3,592
07-06-15 조회 4,095
07-05-31 조회 3,153
07-05-09 조회 5,310
07-05-04 조회 3,157
07-05-04 조회 3,507
07-04-28 조회 6,404
07-04-26 조회 4,643
07-04-14 조회 5,292
07-04-13 조회 3,709
07-04-12 조회 5,897
07-03-27 조회 3,835
07-03-19 조회 3,515
07-03-13 조회 4,609
07-03-07 조회 4,766
07-03-07 조회 3,272
07-02-25 조회 3,636
07-02-21 조회 4,524
07-02-18 조회 5,043
07-02-12 조회 3,387
07-02-02 조회 4,503
07-01-28 조회 6,113
07-01-27 조회 5,622
07-01-25 조회 3,984
07-01-21 조회 4,621
07-01-19 조회 6,568
07-01-19 조회 8,021
07-01-13 조회 3,475
07-01-09 조회 5,113
06-12-27 조회 3,513
06-11-24 조회 3,640
06-11-18 조회 4,158
06-10-17 조회 5,476
06-10-01 조회 4,388
06-09-26 조회 4,277
06-09-25 조회 4,603
06-09-25 조회 4,299
06-09-22 조회 4,845
06-09-22 조회 3,614
06-09-22 조회 4,439
06-09-13 조회 5,276
06-08-27 조회 4,877
06-08-26 조회 6,235
06-08-26 조회 5,558
06-08-23 조회 5,055
06-07-28 조회 7,156
06-07-24 조회 4,611
06-07-23 조회 5,397
06-07-21 조회 5,157
06-07-19 조회 3,036
06-07-19 조회 2,945
06-07-11 조회 3,603
06-07-11 조회 3,900
06-07-11 조회 4,472
06-07-11 조회 4,927
06-07-11 조회 3,557
06-07-11 조회 9,182
06-07-11 조회 4,045
06-07-11 조회 3,274
06-07-11 조회 3,327
06-07-11 조회 3,255
06-07-11 조회 3,054
06-07-07 조회 4,095
06-06-25 조회 4,448
06-06-15 조회 4,438
06-06-14 조회 4,934
06-06-11 조회 3,511
06-06-10 조회 3,895
06-06-09 조회 3,478