묻고답하기
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
[re] GD에서 외부 png이미지를 여러개 불러오는 방법
2002.08.12 13:43
참고하십시요.
http://miplus.x-y.net/miplus/timeline.php
<?
function line( $hour, $min="0", $mid_x="275", $mid_y="25", $x_="275", $y_="275", $color="lightbrown" ) {
GLOBAL $img, $interval;
GLOBAL $white, $balck, $blue, $red, $green, $gray, $lightgray, $lightbrown;
$color = ${$color};
$interval_rad = deg2rad( $interval * $hour + ($interval/60)*$min );
$x = cos(-$interval_rad) * ($mid_x - $x_) + sin(-$interval_rad) * ($mid_y - $y_);
$y = -sin(-$interval_rad) * ($mid_x - $x_) + cos(-$interval_rad) * ($mid_y - $y_);
imagedashedline( $img, $x_, $y_, $x_ + $x, $y_ + $y, $color );
}
$img = imagecreate(551,551);
$white = imagecolorallocate($img, 255,255,255);
$black = imagecolorallocate($img, 0, 0, 0);
$blue = imagecolorallocate($img, 0, 0, 255);
$red = imagecolorallocate($img, 255, 0, 0);
$green = imagecolorallocate($img, 0, 255, 0);
$gray = imagecolorallocate($img, 206, 199, 173);
$lightgray = imagecolorallocate($img, 231, 227, 222);
$lightbrown = imagecolorallocate($img, 148, 142, 99);
//중심점
$interval = 15;
$x_ = $y_ = 275;
$pre_x = 275;
$pre_y = 25;
imagearc( $img, $x_, $y_, 500, 500, 0, 360, $black );
// imagefill( $img, $x_, $y_, $lightgray );
imagearc( $img, $x_, $y_, 500, 500, 0, 360, $black );
$src = imagecreatefrompng("./img/ke.png");
ImageCopy( $img, $src, 355, 150, 0, 0, 40, 40);
imagedestroy($src);
$src = imagecreatefrompng("./img/sleep.png");
ImageCopy( $img, $src, 400, 250, 0, 0, 65, 35);
imagedestroy($src);
//기상
line( 8, 30 );
imagestring( $img, 3, 476, 424, "8:30", $black );
imagestring( $img, 2, 476, 434, "Getting up", $red );
imagestring( $img, 2, 385, 400, "Washing &", $blue );
imagestring( $img, 2, 385, 410, "Going to work", $blue );
//출근
line( 9, 30 );
imagestring( $img, 3, 428, 472, "9:30", $black );
imagestring( $img, 2, 428, 482, "Attendance", $red );
$src = imagecreatefrompng("./img/bus.png");
ImageCopy( $img, $src, 365, 360, 0, 0, 30, 32);
imagedestroy($src);
imagestring( $img, 2, 290, 450, "Forenoon work", $blue );
$src = imagecreatefrompng("./img/human.png");
ImageCopy( $img, $src, 300, 400, 0, 0, 32, 32);
ImageCopy( $img, $src, 130, 380, 0, 0, 32, 32);
ImageCopy( $img, $src, 90, 150, 0, 0, 32, 32);
imagedestroy($src);
//점심시간
line( 12, 30 );
imagestring( $img, 3, 226, 524, "12:30", $black );
imagestring( $img, 2, 180, 460, "Lunch Time", $blue );
$src = imagecreatefrompng("./img/food.png");
ImageCopy( $img, $src, 205, 410, 0, 0, 32, 32);
ImageCopy( $img, $src, 70, 230, 0, 0, 32, 32);
imagedestroy($src);
//오후근무
line( 14, 0 );
imagestring( $img, 3, 135, 490, "14", $black );
imagestring( $img, 2, 100, 340, "Afternoon Work", $blue );
//저녁식사
line( 18, 0 );
imagestring( $img, 3, 10, 270, "18", $black );
imagestring( $img, 2, 70, 260, "Dinner Time", $blue );
//야간근무
line( 19, 0 );
imagestring( $img, 3, 18, 202, "19", $black );
imagestring( $img, 2, 90, 190, "Night Work", $blue );
//퇴근
line( 21, 0 );
imagestring( $img, 3, 85, 87, "21", $black );
imagestring( $img, 2, 40, 77, "Going home", $red );
imagestring( $img, 2, 150, 100, "Have a rest at home", $blue );
$src = imagecreatefrompng("./img/home.png");
ImageCopy( $img, $src, 205, 130, 0, 0, 63, 48);
imagedestroy($src);
//취침
line( 0, 30 );
imagestring( $img, 3, 300, 15, "00:30", $black );
imagestring( $img, 2, 340, 15, "Go to bed", $red );
imagestring( $img, 2, 350, 220, "Sleeping....", $blue );
for( $i=0; $i<80; $i++ ) imagearc( $img, $x_, $y_, $i, $i, 0, 360, $white );
imagepng($img);
imagedestroy($img);
?>
>GD에서 외부PNG 이미지를 여러개 불러와서 하나로 합쳐서
>
>화면에 출력하는것 어떻게 구사하는지 궁급합니다..
>
>자세히좀 설명해 주시면 감사하겠습니다. 외부에서 이미지를 불러와서 출력하는 방법이래도 알려주세요.
http://miplus.x-y.net/miplus/timeline.php
<?
function line( $hour, $min="0", $mid_x="275", $mid_y="25", $x_="275", $y_="275", $color="lightbrown" ) {
GLOBAL $img, $interval;
GLOBAL $white, $balck, $blue, $red, $green, $gray, $lightgray, $lightbrown;
$color = ${$color};
$interval_rad = deg2rad( $interval * $hour + ($interval/60)*$min );
$x = cos(-$interval_rad) * ($mid_x - $x_) + sin(-$interval_rad) * ($mid_y - $y_);
$y = -sin(-$interval_rad) * ($mid_x - $x_) + cos(-$interval_rad) * ($mid_y - $y_);
imagedashedline( $img, $x_, $y_, $x_ + $x, $y_ + $y, $color );
}
$img = imagecreate(551,551);
$white = imagecolorallocate($img, 255,255,255);
$black = imagecolorallocate($img, 0, 0, 0);
$blue = imagecolorallocate($img, 0, 0, 255);
$red = imagecolorallocate($img, 255, 0, 0);
$green = imagecolorallocate($img, 0, 255, 0);
$gray = imagecolorallocate($img, 206, 199, 173);
$lightgray = imagecolorallocate($img, 231, 227, 222);
$lightbrown = imagecolorallocate($img, 148, 142, 99);
//중심점
$interval = 15;
$x_ = $y_ = 275;
$pre_x = 275;
$pre_y = 25;
imagearc( $img, $x_, $y_, 500, 500, 0, 360, $black );
// imagefill( $img, $x_, $y_, $lightgray );
imagearc( $img, $x_, $y_, 500, 500, 0, 360, $black );
$src = imagecreatefrompng("./img/ke.png");
ImageCopy( $img, $src, 355, 150, 0, 0, 40, 40);
imagedestroy($src);
$src = imagecreatefrompng("./img/sleep.png");
ImageCopy( $img, $src, 400, 250, 0, 0, 65, 35);
imagedestroy($src);
//기상
line( 8, 30 );
imagestring( $img, 3, 476, 424, "8:30", $black );
imagestring( $img, 2, 476, 434, "Getting up", $red );
imagestring( $img, 2, 385, 400, "Washing &", $blue );
imagestring( $img, 2, 385, 410, "Going to work", $blue );
//출근
line( 9, 30 );
imagestring( $img, 3, 428, 472, "9:30", $black );
imagestring( $img, 2, 428, 482, "Attendance", $red );
$src = imagecreatefrompng("./img/bus.png");
ImageCopy( $img, $src, 365, 360, 0, 0, 30, 32);
imagedestroy($src);
imagestring( $img, 2, 290, 450, "Forenoon work", $blue );
$src = imagecreatefrompng("./img/human.png");
ImageCopy( $img, $src, 300, 400, 0, 0, 32, 32);
ImageCopy( $img, $src, 130, 380, 0, 0, 32, 32);
ImageCopy( $img, $src, 90, 150, 0, 0, 32, 32);
imagedestroy($src);
//점심시간
line( 12, 30 );
imagestring( $img, 3, 226, 524, "12:30", $black );
imagestring( $img, 2, 180, 460, "Lunch Time", $blue );
$src = imagecreatefrompng("./img/food.png");
ImageCopy( $img, $src, 205, 410, 0, 0, 32, 32);
ImageCopy( $img, $src, 70, 230, 0, 0, 32, 32);
imagedestroy($src);
//오후근무
line( 14, 0 );
imagestring( $img, 3, 135, 490, "14", $black );
imagestring( $img, 2, 100, 340, "Afternoon Work", $blue );
//저녁식사
line( 18, 0 );
imagestring( $img, 3, 10, 270, "18", $black );
imagestring( $img, 2, 70, 260, "Dinner Time", $blue );
//야간근무
line( 19, 0 );
imagestring( $img, 3, 18, 202, "19", $black );
imagestring( $img, 2, 90, 190, "Night Work", $blue );
//퇴근
line( 21, 0 );
imagestring( $img, 3, 85, 87, "21", $black );
imagestring( $img, 2, 40, 77, "Going home", $red );
imagestring( $img, 2, 150, 100, "Have a rest at home", $blue );
$src = imagecreatefrompng("./img/home.png");
ImageCopy( $img, $src, 205, 130, 0, 0, 63, 48);
imagedestroy($src);
//취침
line( 0, 30 );
imagestring( $img, 3, 300, 15, "00:30", $black );
imagestring( $img, 2, 340, 15, "Go to bed", $red );
imagestring( $img, 2, 350, 220, "Sleeping....", $blue );
for( $i=0; $i<80; $i++ ) imagearc( $img, $x_, $y_, $i, $i, 0, 360, $white );
imagepng($img);
imagedestroy($img);
?>
>GD에서 외부PNG 이미지를 여러개 불러와서 하나로 합쳐서
>
>화면에 출력하는것 어떻게 구사하는지 궁급합니다..
>
>자세히좀 설명해 주시면 감사하겠습니다. 외부에서 이미지를 불러와서 출력하는 방법이래도 알려주세요.