테스트 사이트 - 개발 중인 베타 버전입니다

이미지에 박스 넣기

//이미지에 네모 박스 집어넣기
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개

도움이 많이 되었습니다..감사합니다.

게시글 목록

번호 제목
12201
12200
29244
12196
29243
12188
12184
29231
29230
12181
기타 툴팁 2
29229
12179
12177
12173
29226
12172
25007
12171
12170
29225
12167
12166
12157
12154
12153
25002
12151
29224
12148
29223
12142
29217
12141
12136
12132
12130
29216
29215
12126
12124
12122
12120
12111
25001
25000
24999
24998
24997
24994
24985
12109
12105
12104
12096
12094
12091
12090
12079
29211
12072
29210
12070
29207
12067
12061
29204
12058
12057
12056
24984
12055
12053
12051
MySQL apm 1
12050
MySQL LOG
12049
12048
기타 dhcp
12047
12046
12045
12044
12043
JavaScript vi
12042
기타 Nis/NFS
12041
12040
JavaScript
12039
기타 Process
12038
12037
12036
12035
JavaScript Quota
12034
MySQL LOG
12033
12032
12031
JavaScript IPCHAINS
12028
12026
12025
12020
12017
12015
12013