유

이미지에 박스 넣기

· 2008-01-15 (화) 16:26:22 · 3393 · 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건
+
제목 글쓴이 날짜 조회
10-09-25 조회 2,715
10-09-19 조회 2,752
10-09-15 조회 2,754
10-09-15 조회 4,157
10-09-15 조회 3,373
10-09-15 조회 2,489
10-09-07 조회 3,599
10-08-27 조회 4,061
10-06-11 조회 4,222
10-05-31 조회 2,472
10-02-27 조회 4,998
10-02-09 조회 3,748
09-10-10 조회 7,339
09-03-19 조회 3,182
09-02-09 조회 3,460
09-02-09 조회 4,531
08-11-01 조회 2,906
08-09-29 조회 4,559
08-09-26 조회 3,511
08-09-26 조회 3,589
08-09-26 조회 2,724
08-09-26 조회 3,768
08-09-26 조회 3,492
08-09-26 조회 4,253
08-09-18 조회 3,570
08-09-09 조회 3,225
08-08-28 조회 2,767
08-07-06 조회 3,539
08-05-21 조회 4,700
08-05-13 조회 4,535
08-04-17 조회 4,914
08-02-19 조회 3,535
08-01-18 조회 3,841
08-01-10 조회 3,814
07-10-22 조회 3,653
07-10-09 조회 4,305
07-10-03 조회 3,511
07-07-06 조회 4,211
07-07-06 조회 4,425
07-07-06 조회 4,035
07-06-28 조회 3,564
07-06-05 조회 3,564
07-06-05 조회 4,112
07-05-30 조회 3,285
07-05-02 조회 3,685
07-04-15 조회 5,143
07-04-11 조회 3,628
07-04-05 조회 3,926
07-03-31 조회 3,148
07-03-31 조회 4,122
07-03-30 조회 3,729
07-03-24 조회 4,000
07-03-22 조회 3,657
07-03-12 조회 4,406
07-02-16 조회 3,268
07-02-14 조회 5,165
07-02-10 조회 3,994
07-02-09 조회 4,377
07-01-19 조회 4,044
07-01-16 조회 4,972
06-12-16 조회 5,835
06-11-30 조회 3,599
06-11-25 조회 3,700
06-10-15 조회 5,065
06-09-26 조회 5,308
06-09-26 조회 5,425
06-09-22 조회 4,268
06-09-21 조회 3,542
06-09-21 조회 3,632
06-09-02 조회 3,484
06-08-08 조회 5,114
06-07-20 조회 3,718
06-07-17 조회 3,348
06-07-13 조회 4,171
06-07-11 조회 3,471
06-07-11 조회 3,476
06-07-11 조회 3,835
06-06-29 조회 6,054
06-06-19 조회 6,454
06-06-02 조회 3,508
06-05-24 조회 4,994
06-05-14 조회 7,775
06-05-08 조회 3,883
06-02-02 조회 5,451
05-12-16 조회 4,501
05-12-05 조회 5,154
05-06-28 조회 4,105
05-04-11 조회 4,061
05-04-11 조회 4,248
05-04-11 조회 3,315
05-03-13 조회 3,218
05-03-12 조회 4,296
04-12-08 조회 7,778
04-12-01 조회 5,182
04-11-28 조회 3,357
04-11-28 조회 3,197
04-08-05 조회 5,612
04-08-05 조회 4,964
04-08-05 조회 5,569