유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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,421
08-03-14 조회 3,259
08-03-08 조회 3,083
08-03-06 조회 3,070
08-03-03 조회 4,363
08-02-20 조회 3,040
08-02-15 조회 3,941
08-02-11 조회 5,102
08-02-09 조회 5,833
08-02-05 조회 3,889
08-01-14 조회 6,691
08-01-11 조회 7,135
08-01-04 조회 1.1만
07-12-10 조회 5,028
07-12-10 조회 3,909
07-12-04 조회 3,443
07-11-29 조회 3,632
07-11-27 조회 3,980
07-11-23 조회 4,558
07-11-23 조회 4,293
07-11-13 조회 4,431
07-10-19 조회 4,895
07-10-17 조회 5,943
07-10-03 조회 5,118
07-10-02 조회 8,873
07-10-02 조회 4,519
07-09-09 조회 3,507
07-07-29 조회 4,397
07-07-28 조회 4,614
07-07-26 조회 4,514
07-06-19 조회 1.1만
07-06-17 조회 3,660
07-06-15 조회 4,159
07-05-31 조회 3,243
07-05-09 조회 5,398
07-05-04 조회 3,245
07-05-04 조회 3,574
07-04-28 조회 6,489
07-04-26 조회 4,733
07-04-14 조회 5,367
07-04-13 조회 3,797
07-04-12 조회 5,962
07-03-27 조회 3,911
07-03-19 조회 3,610
07-03-13 조회 4,682
07-03-07 조회 4,827
07-03-07 조회 3,335
07-02-25 조회 3,708
07-02-21 조회 4,599
07-02-18 조회 5,122
07-02-12 조회 3,467
07-02-02 조회 4,613
07-01-28 조회 6,226
07-01-27 조회 5,719
07-01-25 조회 4,090
07-01-21 조회 4,709
07-01-19 조회 6,642
07-01-19 조회 8,095
07-01-13 조회 3,581
07-01-09 조회 5,231
06-12-27 조회 3,622
06-11-24 조회 3,718
06-11-18 조회 4,222
06-10-17 조회 5,559
06-10-01 조회 4,458
06-09-26 조회 4,351
06-09-25 조회 4,701
06-09-25 조회 4,387
06-09-22 조회 4,924
06-09-22 조회 3,696
06-09-22 조회 4,553
06-09-13 조회 5,353
06-08-27 조회 4,956
06-08-26 조회 6,322
06-08-26 조회 5,638
06-08-23 조회 5,123
06-07-28 조회 7,229
06-07-24 조회 4,687
06-07-23 조회 5,467
06-07-21 조회 5,231
06-07-19 조회 3,117
06-07-19 조회 3,045
06-07-11 조회 3,684
06-07-11 조회 3,972
06-07-11 조회 4,580
06-07-11 조회 5,013
06-07-11 조회 3,634
06-07-11 조회 9,255
06-07-11 조회 4,106
06-07-11 조회 3,338
06-07-11 조회 3,381
06-07-11 조회 3,328
06-07-11 조회 3,130
06-07-07 조회 4,170
06-06-25 조회 4,520
06-06-15 조회 4,507
06-06-14 조회 4,998
06-06-11 조회 3,603
06-06-10 조회 3,975
06-06-09 조회 3,563