유

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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건
+
제목 글쓴이 날짜 조회
07-04-22 조회 2,610
07-04-22 조회 2,434
07-04-22 조회 2,358
07-04-21 조회 2,425
07-04-21 조회 2,752
07-04-21 조회 2,101
07-04-21 조회 2,524
07-04-21 조회 2,358
07-04-21 조회 2,435
07-04-20 조회 4,249
07-04-20 조회 2,158
07-04-20 조회 2,379
07-04-20 조회 3,417
07-04-20 조회 3,518
07-04-20 조회 2,543
07-04-20 조회 3,144
07-04-20 조회 2,406
07-04-19 조회 3,759
07-04-18 조회 7,834
07-04-18 조회 5,038
07-04-18 조회 3,433
07-04-17 조회 7,589
07-04-17 조회 3,852
07-04-17 조회 3,892
07-04-17 조회 3,336
07-04-16 조회 3,350
07-04-16 조회 3,339
07-04-16 조회 5,210
07-04-15 조회 5,260
07-04-15 조회 6,333
07-04-14 조회 5,432
07-04-13 조회 3,862
07-04-13 조회 3,174
07-04-13 조회 4,134
07-04-13 조회 3,994
07-04-13 조회 3,492
07-04-12 조회 6,687
07-04-12 조회 6,031
07-04-12 조회 5,091
07-04-12 조회 4,690
07-04-12 조회 3,371
07-04-12 조회 3,411
07-04-12 조회 4,928
07-04-11 조회 3,534
07-04-11 조회 3,735
07-04-11 조회 2,977
07-04-11 조회 5,770
07-04-11 조회 3,383
07-04-11 조회 3,507
07-04-11 조회 5,262
07-04-08 조회 5,245
07-04-07 조회 3,337
07-04-05 조회 4,022
07-04-05 조회 6,400
07-04-04 조회 3,628
07-04-04 조회 4,202
07-04-02 조회 9,838
07-03-31 조회 3,229
07-03-31 조회 4,208
07-03-30 조회 3,843
07-03-30 조회 4,216
07-03-29 조회 3,678
07-03-29 조회 3,724
07-03-27 조회 3,971
07-03-27 조회 5,191
07-03-27 조회 3,883
07-03-26 조회 3,943
07-03-24 조회 4,468
07-03-24 조회 4,079
07-03-23 조회 3,320
07-03-22 조회 3,745
07-03-21 조회 3,777
07-03-21 조회 5,276
07-03-21 조회 6,005
07-03-20 조회 3,600
07-03-20 조회 3,780
07-03-20 조회 3,674
07-03-20 조회 5,019
07-03-19 조회 3,652
07-03-19 조회 3,569
07-03-18 조회 2,892
07-03-18 조회 3,189
07-03-18 조회 4,021
07-03-18 조회 4,766
07-03-17 조회 4,269
07-03-16 조회 4,168
07-03-16 조회 3,200
07-03-15 조회 5,336
07-03-15 조회 3,417
07-03-13 조회 5,435
07-03-13 조회 3,732
07-03-13 조회 3,618
07-03-13 조회 4,727
07-03-13 조회 3,452
07-03-13 조회 3,345
07-03-12 조회 4,501
07-03-11 조회 5,188
07-03-11 조회 3,427
07-03-11 조회 3,604
07-03-10 조회 5,042