유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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건
+
제목 글쓴이 날짜 조회
08-09-05 조회 3,662
08-09-05 조회 5,237
08-09-05 조회 3,099
08-09-05 조회 3,718
08-09-05 조회 3,613
08-09-05 조회 3,063
08-09-05 조회 3,609
08-09-04 조회 3,494
08-09-04 조회 3,414
08-09-03 조회 4,597
08-09-03 조회 3,545
08-09-03 조회 2,869
08-09-03 조회 2,851
08-09-03 조회 3,559
08-09-01 조회 4,643
08-08-29 조회 3,631
08-08-28 조회 2,902
08-08-28 조회 5,671
08-08-27 조회 3,392
08-08-21 조회 4,921
08-08-18 조회 7,519
08-08-18 조회 2,988
08-08-18 조회 2,973
08-08-18 조회 2,560
08-08-17 조회 2,710
08-08-16 조회 4,519
08-08-15 조회 3,381
08-08-15 조회 3,969
08-08-14 조회 2,580
08-08-14 조회 4,602
08-08-13 조회 3,479
08-08-12 조회 4,070
08-08-11 조회 2,735
08-08-10 조회 3,131
08-08-09 조회 2,448
08-08-08 조회 2,567
08-08-08 조회 3,133
08-08-08 조회 2,500
08-08-08 조회 5,632
08-08-07 조회 2,887
08-08-05 조회 3,303
08-08-03 조회 8,517
08-08-03 조회 2,659
08-08-02 조회 3,237
08-08-01 조회 4,589
08-07-31 조회 2,572
08-07-31 조회 3,308
08-07-31 조회 2,429
08-07-31 조회 3,136
08-07-30 조회 3,547
08-07-28 조회 4,428
08-07-25 조회 2,528
08-07-23 조회 2,608
08-07-23 조회 2,879
08-07-22 조회 2,506
08-07-22 조회 5,663
08-07-22 조회 5,264
08-07-22 조회 4,140
08-07-20 조회 2,850
08-07-19 조회 2,608
08-07-18 조회 3,010
08-07-18 조회 3,895
08-07-17 조회 2,993
08-07-15 조회 3,366
08-07-15 조회 2,560
08-07-11 조회 2,319
08-07-11 조회 2,395
08-07-10 조회 4,342
08-07-10 조회 3,820
08-07-10 조회 3,361
08-07-10 조회 3,377
08-07-10 조회 3,093
08-07-10 조회 3,539
08-07-10 조회 3,364
08-07-10 조회 3,218
08-07-08 조회 3,158
08-07-08 조회 2,431
08-07-06 조회 3,112
08-07-06 조회 3,641
08-07-05 조회 3,667
08-07-04 조회 3,045
08-07-03 조회 2,816
08-07-03 조회 2,693
08-07-02 조회 3,845
08-06-30 조회 3,913
08-06-30 조회 3,398
08-06-30 조회 3,709
08-06-28 조회 4,031
08-06-27 조회 2,559
08-06-27 조회 2,504
08-06-27 조회 7,670
08-06-27 조회 2,436
08-06-25 조회 2,873
08-06-24 조회 3,095
08-06-24 조회 2,361
08-06-23 조회 2,429
08-06-19 조회 3,236
08-06-19 조회 2,855
08-06-19 조회 5,004
08-06-19 조회 2,475