유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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-06-19 조회 2,419
08-06-15 조회 3,168
08-06-15 조회 2,404
08-06-14 조회 2,743
08-06-14 조회 3,632
08-06-14 조회 3,328
08-06-12 조회 2,209
08-06-11 조회 2,239
08-06-11 조회 2,337
08-06-11 조회 7,369
08-06-11 조회 7,104
08-06-08 조회 3,286
08-06-07 조회 2,216
08-06-05 조회 2,340
08-06-05 조회 3,319
08-06-05 조회 2,681
08-06-05 조회 2,340
08-06-05 조회 2,363
08-06-04 조회 2,285
08-06-03 조회 2,281
08-06-03 조회 5,359
08-06-03 조회 3,591
08-06-02 조회 2,887
08-06-02 조회 4,026
08-06-01 조회 2,642
08-05-31 조회 2,343
08-05-31 조회 2,354
08-05-31 조회 2,434
08-05-30 조회 2,311
08-05-29 조회 2,453
08-05-29 조회 3,716
08-05-27 조회 5,560
08-05-26 조회 2,395
08-05-26 조회 5,305
08-05-25 조회 5,391
08-05-24 조회 2,455
08-05-23 조회 3,470
08-05-23 조회 2,870
08-05-23 조회 4,635
08-05-22 조회 2,628
08-05-21 조회 4,985
08-05-21 조회 4,758
08-05-21 조회 3,908
08-05-20 조회 4,506
08-05-20 조회 4,096
08-05-20 조회 3,322
08-05-20 조회 4,586
08-05-20 조회 3,940
08-05-20 조회 4,831
08-05-19 조회 2,366
08-05-16 조회 3,493
08-05-15 조회 2,552
08-05-15 조회 2,391
08-05-15 조회 2,382
08-05-14 조회 2,314
08-05-13 조회 2,770
08-05-13 조회 4,173
08-05-13 조회 4,599
08-05-09 조회 4,369
08-05-08 조회 3,126
08-05-08 조회 5,281
08-05-08 조회 2,633
08-05-07 조회 2,333
08-05-07 조회 2,481
08-05-07 조회 2,287
08-05-01 조회 2,609
08-05-01 조회 2,962
08-04-29 조회 3,805
08-04-28 조회 3,623
08-04-26 조회 2,637
08-04-26 조회 2,383
08-04-26 조회 3,648
08-04-25 조회 4,078
08-04-23 조회 4,513
08-04-22 조회 4,450
08-04-22 조회 3,612
08-04-22 조회 5,167
08-04-22 조회 4,549
08-04-22 조회 6,929
08-04-22 조회 3,998
08-04-21 조회 3,137
08-04-21 조회 3,191
08-04-21 조회 3,130
08-04-21 조회 2,963
08-04-21 조회 4,072
08-04-20 조회 3,236
08-04-20 조회 2,921
08-04-20 조회 3,453
08-04-19 조회 2,348
08-04-18 조회 3,055
08-04-18 조회 4,398
08-04-17 조회 3,615
08-04-17 조회 3,066
08-04-17 조회 3,285
08-04-17 조회 2,570
08-04-17 조회 2,971
08-04-17 조회 2,451
08-04-17 조회 3,007
08-04-17 조회 3,062
08-04-17 조회 2,269