유

이미지에 박스 넣기

· 2008-01-15 (화) 16:26:22 · 3383 · 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건
+
제목 글쓴이 날짜 조회
08-01-27 조회 3,809
08-01-26 조회 8,568
08-01-21 조회 3,323
08-01-08 조회 3,771
07-12-21 조회 4,711
07-12-14 조회 4,866
07-12-13 조회 6,311
07-12-10 조회 4,167
07-12-03 조회 3,255
07-12-03 조회 4,297
07-11-27 조회 5,792
07-11-26 조회 3,002
07-11-22 조회 5,118
07-11-21 조회 3,329
07-11-21 조회 1.1만
07-11-12 조회 4,074
07-11-07 조회 4,841
07-10-29 조회 3,587
07-10-25 조회 5,001
07-10-24 조회 3,795
07-10-23 조회 5,990
07-10-09 조회 4,148
07-10-09 조회 4,610
07-10-09 조회 3,209
07-10-09 조회 3,566
07-09-27 조회 3,866
07-09-27 조회 3,093
07-09-15 조회 4,020
07-09-13 조회 2,793
07-09-13 조회 3,256
07-08-07 조회 3,280
07-08-04 조회 3,428
07-07-30 조회 5,435
07-07-29 조회 3,793
07-07-29 조회 4,465
07-07-21 조회 3,111
07-07-20 조회 3,152
07-07-20 조회 4,329
07-07-07 조회 3,391
07-07-06 조회 5,214
07-07-06 조회 5,612
07-07-05 조회 6,754
07-07-04 조회 3,385
07-06-11 조회 3,905
07-06-04 조회 7,251
07-05-28 조회 4,877
07-05-14 조회 6,345
07-05-10 조회 5,289
07-05-09 조회 3,394
07-05-04 조회 3,689
07-04-27 조회 3,335
07-04-25 조회 4,655
07-04-19 조회 3,617
07-04-16 조회 3,227
07-04-13 조회 3,840
07-04-12 조회 4,564
07-04-12 조회 4,779
07-04-11 조회 3,408
07-04-08 조회 5,137
07-04-07 조회 3,240
07-03-29 조회 3,548
07-03-27 조회 3,757
07-03-21 조회 5,154
07-03-15 조회 3,286
07-03-11 조회 3,308
07-03-10 조회 4,942
07-03-09 조회 3,945
07-03-08 조회 4,829
07-03-05 조회 2,948
07-03-02 조회 3,038
07-03-02 조회 3,875
07-02-26 조회 2,929
07-02-26 조회 3,019
07-02-23 조회 4,264
07-02-23 조회 3,331
07-02-23 조회 3,338
07-02-23 조회 3,520
07-02-22 조회 3,154
07-02-21 조회 4,807
07-02-20 조회 4,609
07-02-14 조회 3,756
07-02-12 조회 5,352
07-02-11 조회 4,785
07-02-10 조회 4,086
07-02-09 조회 3,859
07-02-08 조회 4,525
07-02-03 조회 4,121
07-02-02 조회 3,498
07-01-09 조회 3,583
07-01-08 조회 3,954
06-12-26 조회 4,650
06-12-21 조회 3,756
06-12-15 조회 4,165
06-12-15 조회 7,444
06-12-15 조회 3,172
06-12-15 조회 3,194
06-12-15 조회 3,469
06-12-15 조회 3,125
06-12-15 조회 4,541
06-12-15 조회 3,141