유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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-04-03 조회 2,779
08-04-02 조회 2,981
08-04-02 조회 2,849
08-04-02 조회 3,167
08-04-02 조회 3,126
08-04-02 조회 3,157
08-04-02 조회 3,101
08-04-02 조회 2,799
08-04-02 조회 2,798
08-04-02 조회 2,903
08-04-02 조회 3,201
08-04-02 조회 3,093
08-04-02 조회 2,875
08-04-02 조회 3,021
08-04-02 조회 2,685
08-04-02 조회 2,943
08-04-02 조회 3,265
08-04-02 조회 4,061
08-04-02 조회 3,264
08-03-31 조회 2,559
08-03-31 조회 3,128
08-03-31 조회 3,621
08-03-29 조회 2,752
08-03-28 조회 3,458
08-03-28 조회 2,959
08-03-28 조회 2,629
08-03-27 조회 2,459
08-03-26 조회 3,358
08-03-26 조회 4,317
08-03-25 조회 3,791
08-03-25 조회 2,804
08-03-25 조회 4,119
08-03-25 조회 3,627
08-03-25 조회 4,048
08-03-25 조회 4,072
08-03-25 조회 3,733
08-03-25 조회 3,633
08-03-25 조회 2,886
08-03-25 조회 3,638
08-03-25 조회 5,340
08-03-21 조회 3,008
08-03-19 조회 5,172
08-03-18 조회 3,027
08-03-16 조회 2,986
08-03-14 조회 3,303
08-03-13 조회 3,697
08-03-13 조회 2,680
08-03-11 조회 3,007
08-03-11 조회 3,554
08-03-11 조회 3,045
08-03-11 조회 3,008
08-03-11 조회 2,802
08-03-11 조회 2,645
08-03-11 조회 2,586
08-03-11 조회 2,396
08-03-11 조회 2,407
08-03-11 조회 2,460
08-03-11 조회 2,436
08-03-11 조회 2,843
08-03-11 조회 2,916
08-03-08 조회 3,141
08-03-07 조회 4,254
08-03-07 조회 3,358
08-03-07 조회 3,018
08-03-06 조회 3,357
08-03-06 조회 3,111
08-03-06 조회 4,799
08-03-05 조회 2,733
08-03-04 조회 2,880
08-03-04 조회 2,581
08-03-04 조회 3,438
08-03-03 조회 4,413
08-02-28 조회 3,497
08-02-27 조회 2,994
08-02-22 조회 4,315
08-02-22 조회 5,694
08-02-22 조회 2,961
08-02-21 조회 4,636
08-02-21 조회 2,858
08-02-21 조회 4,858
08-02-21 조회 7,137
08-02-21 조회 2,648
08-02-21 조회 3,413
08-02-20 조회 3,084
08-02-19 조회 2,749
08-02-19 조회 3,608
08-02-19 조회 3,820
08-02-15 조회 2,784
08-02-15 조회 3,976
08-02-14 조회 4,475
08-02-14 조회 2,677
08-02-12 조회 3,131
08-02-11 조회 5,127
08-02-09 조회 5,865
08-02-09 조회 3,058
08-02-08 조회 2,914
08-02-05 조회 3,925
08-02-04 조회 3,129
08-02-03 조회 5,415
08-02-03 조회 2,826