유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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,187건
+
제목 글쓴이 날짜 조회
09-10-03 조회 3,186
08-02-03 조회 3,489
08-02-03 조회 3,427
08-01-30 조회 4,942
08-01-29 조회 2,810
08-01-27 조회 3,946
08-01-27 조회 2,883
08-01-27 조회 3,159
08-01-26 조회 8,707
08-01-26 조회 3,260
08-01-24 조회 5,313
08-01-23 조회 3,656
08-01-21 조회 3,697
08-01-21 조회 3,444
08-01-21 조회 3,465
08-01-18 조회 3,978
08-01-18 조회 4,612
08-01-18 조회 6,777
08-01-18 조회 4,053
08-01-17 조회 4,040
08-01-17 조회 3,868
08-01-16 조회 3,123
08-01-15 조회 3,504
08-01-14 조회 6,756
08-01-12 조회 4,355
08-01-12 조회 3,918
08-01-12 조회 4,633
08-01-12 조회 3,875
08-01-12 조회 4,170
08-01-11 조회 7,199
08-01-10 조회 3,943
08-01-08 조회 3,476
08-01-08 조회 3,957
08-01-06 조회 2,740
08-01-04 조회 1.1만
08-01-02 조회 5,823
07-12-28 조회 4,756
07-12-24 조회 3,176
07-12-21 조회 4,872
07-12-17 조회 3,657
07-12-14 조회 5,028
07-12-13 조회 6,463
07-12-10 조회 5,106
07-12-10 조회 3,980
07-12-10 조회 4,378
07-12-08 조회 3,739
07-12-07 조회 4,070
07-12-07 조회 3,202
07-12-06 조회 4,945
07-12-04 조회 3,530
07-12-04 조회 3,680
07-12-03 조회 3,436
07-12-03 조회 4,459
07-12-02 조회 3,291
07-11-30 조회 4,036
07-11-30 조회 5,263
07-11-30 조회 5,866
07-11-29 조회 3,714
07-11-27 조회 4,171
07-11-27 조회 5,944
07-11-27 조회 4,045
07-11-26 조회 3,168
07-11-23 조회 4,625
07-11-23 조회 4,355
07-11-22 조회 5,262
07-11-21 조회 3,480
07-11-21 조회 3,604
07-11-21 조회 1.2만
07-11-20 조회 4,985
07-11-16 조회 4,843
07-11-13 조회 4,507
07-11-12 조회 4,233
07-11-10 조회 5,611
07-11-08 조회 6,775
07-11-08 조회 5,098
07-11-07 조회 4,573
07-11-07 조회 5,018
07-11-06 조회 3,564
07-11-06 조회 3,924
07-11-05 조회 5,259
07-11-02 조회 4,144
07-11-01 조회 5,610
07-10-31 조회 3,297
07-10-30 조회 3,766
07-10-29 조회 3,759
07-10-26 조회 5,080
07-10-25 조회 5,166
07-10-25 조회 3,945
07-10-24 조회 3,939
07-10-24 조회 4,257
07-10-24 조회 4,116
07-10-24 조회 3,389
07-10-24 조회 3,505
07-10-23 조회 6,153
07-10-23 조회 5,543
07-10-22 조회 4,273
07-10-22 조회 3,654
07-10-22 조회 4,194
07-10-22 조회 3,772
07-10-19 조회 4,825