유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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건
+
제목 글쓴이 날짜 조회
07-07-16 조회 3,111
07-07-06 조회 2,995
07-07-06 조회 3,428
07-06-23 조회 3,254
07-06-16 조회 2,765
07-05-20 조회 4,263
07-05-09 조회 3,446
07-05-09 조회 6,084
07-05-04 조회 2,683
07-04-30 조회 9,817
07-04-27 조회 4,319
07-04-26 조회 3,435
07-04-25 조회 5,270
07-04-18 조회 7,774
07-04-13 조회 3,106
07-04-12 조회 6,620
07-04-12 조회 5,024
07-04-12 조회 3,333
07-04-11 조회 5,703
07-04-05 조회 6,348
07-03-24 조회 4,405
07-03-20 조회 3,726
07-03-18 조회 3,986
07-03-18 조회 4,731
07-03-17 조회 4,225
07-03-16 조회 4,119
07-03-15 조회 5,282
07-03-13 조회 5,388
07-03-13 조회 3,576
07-03-08 조회 4,485
07-03-08 조회 3,969
07-03-08 조회 3,285
07-03-08 조회 4,173
07-03-05 조회 4,418
07-03-04 조회 2,899
07-03-01 조회 5,935
07-02-28 조회 3,227
07-02-27 조회 4,397
07-02-26 조회 3,309
07-02-26 조회 3,024
07-02-23 조회 3,656
07-02-23 조회 3,625
07-02-22 조회 4,006
07-02-22 조회 3,812
07-02-19 조회 3,842
07-02-17 조회 4,862
07-02-14 조회 8,157
07-02-12 조회 3,925
07-02-10 조회 3,541
07-02-02 조회 3,789
07-01-31 조회 3,461
07-01-29 조회 3,322
07-01-25 조회 5,109
07-01-21 조회 3,254
07-01-19 조회 3,037
06-12-15 조회 4,040
06-12-15 조회 4,456
06-12-15 조회 2,943
06-12-15 조회 4,484
06-12-15 조회 3,380
06-12-15 조회 4,088
06-12-15 조회 3,035
06-12-15 조회 2,761
06-12-15 조회 4,625
06-12-15 조회 3,170
06-12-15 조회 3,270
06-12-07 조회 4,710
06-12-07 조회 3,999
06-12-04 조회 4,649
06-11-27 조회 3,690
06-11-21 조회 4,010
06-11-15 조회 3,437
06-11-04 조회 3,323
06-10-29 조회 3,980
06-10-13 조회 3,837
06-10-13 조회 4,208
06-10-13 조회 4,170
06-10-12 조회 5,362
06-10-12 조회 4,268
06-10-04 조회 3,770
06-10-02 조회 4,555
06-09-29 조회 3,043
06-09-26 조회 3,382
06-09-26 조회 3,642
06-09-26 조회 3,291
06-09-26 조회 3,438
06-09-26 조회 4,337
06-09-25 조회 4,646
06-09-22 조회 4,984
06-09-22 조회 3,549
06-09-21 조회 4,321
06-09-21 조회 4,331
06-09-21 조회 3,540
06-09-21 조회 5,188
06-09-21 조회 3,719
06-09-21 조회 3,452
06-09-20 조회 3,021
06-09-15 조회 3,141
06-09-13 조회 3,462
06-09-11 조회 3,278