유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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,677
08-10-30 조회 2,777
08-10-20 조회 2,504
08-10-11 조회 2,413
08-09-20 조회 4,156
08-09-20 조회 2,821
08-09-18 조회 2,686
08-09-18 조회 3,398
08-09-17 조회 3,274
08-09-05 조회 4,609
08-09-03 조회 2,729
08-08-18 조회 2,875
08-08-17 조회 2,621
08-08-13 조회 3,393
08-07-30 조회 3,459
08-07-28 조회 4,335
08-07-22 조회 5,565
08-07-22 조회 4,048
08-07-10 조회 3,014
08-07-08 조회 3,079
08-06-30 조회 3,840
08-06-30 조회 3,320
08-06-30 조회 3,636
08-06-14 조회 2,699
08-06-11 조회 7,075
08-06-05 조회 3,292
08-05-20 조회 4,799
08-05-13 조회 4,132
08-05-08 조회 3,091
08-05-08 조회 5,247
08-04-25 조회 4,044
08-04-22 조회 4,506
08-04-21 조회 3,150
08-04-17 조회 2,532
08-04-17 조회 2,928
08-04-17 조회 2,225
08-04-17 조회 5,195
08-04-17 조회 4,518
08-04-17 조회 4,508
08-04-17 조회 3,288
08-04-17 조회 3,118
08-04-17 조회 3,613
08-04-17 조회 4,976
08-04-17 조회 5,129
08-04-17 조회 3,337
08-04-04 조회 4,573
08-04-04 조회 2,810
08-04-04 조회 2,554
08-04-04 조회 2,785
08-04-04 조회 2,522
08-04-04 조회 2,753
08-04-03 조회 2,641
08-04-03 조회 2,715
08-04-02 조회 3,028
08-04-02 조회 3,179
08-03-31 조회 3,077
08-03-26 조회 4,246
08-03-11 조회 2,934
08-03-11 조회 2,346
08-03-11 조회 2,353
08-03-07 조회 4,184
08-03-07 조회 3,284
08-03-06 조회 4,724
08-03-04 조회 3,367
08-02-19 조회 3,762
08-02-03 조회 3,388
08-01-18 조회 3,965
08-01-15 조회 3,421
08-01-12 조회 4,269
08-01-12 조회 3,835
08-01-12 조회 3,785
07-12-24 조회 3,067
07-11-30 조회 3,917
07-11-08 조회 4,978
07-11-06 조회 3,824
07-10-26 조회 4,975
07-10-24 조회 4,157
07-10-22 조회 3,554
07-10-19 조회 4,729
07-10-09 조회 4,860
07-10-09 조회 6,738
07-10-05 조회 3,070
07-10-05 조회 4,003
07-10-03 조회 7,511
07-10-03 조회 3,560
07-10-03 조회 2,896
07-10-03 조회 2,832
07-09-28 조회 4,661
07-09-27 조회 3,737
07-09-27 조회 3,189
07-09-13 조회 3,331
07-08-28 조회 3,428
07-08-04 조회 4,808
07-08-01 조회 5,513
07-08-01 조회 4,921
07-07-30 조회 5,419
07-07-29 조회 3,560
07-07-21 조회 3,400
07-07-18 조회 5,352
07-07-16 조회 3,166