아래소스는 디렉토리 내의 이미지보기(겔러리) 소스 입니다.
사용하기 편하고 업로드 방식이 계정에 직접 파일을 한꺼번에 올려주면..
해당폴더의 파일을 보여주는 형식 입니다.
제가 사용하게 된지가 오래 되어서 출처는 잘 모르겠습니다.
조금 불편하고 개선할 부분이 있어서 혹시 관심이 있는 분이 있으시면..
수정 부탁 드립니다.
-수정할 사항-
1) 썸레일 기능이 없습니다.
2) 이미지 클릭후 팝업창에서 원본이미지 클릭하면 윈도우가 닫혔으면 좋겠습니다.
현재사용하는 페이지 : http://lbw.kr/icon/icons.php
<!--소스시작-->
<?
//$code = 파일확장자
//$imagefile = 그림파일명
//$imagewidth = 이미지의 가로길이
//$imageheight = 이미지의 세로길이
//$page = 페이지번호
$tdwidth = 100; // 테이블 한칸의 가로길이
$tdheight = 100; // 테이블 한칸의 세로길이
$imggaro = 6; // 그림 가로 출력 갯수
$imgsero = 5; // 그림 세로 출력 갯수
$viewimg = $imggaro * $imgsero; // 한화면의 그림 출력 갯수
?>
<?
$handle=opendir("."); //시작할 폴더위치를 지정한다.
//그림파일 전체 갯수 구함
while ($imagefile = readdir($handle))
{
$code = substr($imagefile,-3); //확장자검색
if($code == jpg || $code == gif) //그림파일확인
{
$num++;
}
}
//echo("그림파일 : $num 개");
if($page == "" || $page == "0" || $page == "1")
{
$page = "1";
}
//NEXT , PREVIEW 만들기.
$next = $page+1;
$preview = $page-1;
if($page == 1)
{
//echo("[ 이전 ]");
//echo("<a href=$PHP_SELF?page=$next><b>[ 다음 ]</b></a> <br>");
}
else if($page == intval($num/$viewimg)+1)
{
//echo("<a href=$PHP_SELF?page=$preview><b>[ 이전 ]</b></a> ");
//echo("[ 다음 ]<br>");
}
else
{
//echo("<a href=$PHP_SELF?page=$preview><b>[ 이전 ]</b></a> ");
//echo("<a href=$PHP_SELF?page=$next><b>[ 다음 ]</b></a> <br>");
}
//페이지 설정
$for = intval($num/$viewimg)+1;
for($i=1; $i <= $for; $i++)
{
if($page == $i)
{
echo(" <a href=$PHP_SELF?page=$i><b>[$i]</b></a> ");
}
else
{
echo(" <a href=$PHP_SELF?page=$i>[$i]</a> ");
}
}
closedir($handle);
?>
<table width="100%" height="500" cellpadding="2" cellspacing="2" border="0">
<tr>
<?
$handle=opendir("."); //시작할 폴더위치를 지정한다.
while ($imagefile = readdir($handle))
{
$code = substr($imagefile,-3); //확장자검색
if($code == jpg || $code == gif) //그림파일확인
{
$k++;
if( $k > (($viewimg*$page)-$viewimg) && $k <= ($viewimg*$page)) //나타내야할 부분 추출 한다.
{
$imagehw = GetImageSize($imagefile); // 이미지 사이크를 구함.
$imagewidth = $imagehw[0]; // 이미지 가로길이
$imageheight = $imagehw[1]; // 이미지 세로길이
$imagewidth20 = $imagewidth+20;
$imageheight20 = $imageheight+20;
// 이미지 가로길이가 테이블 한칸 가로길이보다 클경우
if($imagewidth >= $tdwidth)
{
$x = $imagewidth/$tdwidth;
$imageheight = intval($imageheight/$x);
$imagewidth = $tdwidth;
}
// 이미지 세로길이가 테이블 한칸 세로길이보다 클경우
if($imageheight > $tdheight)
{
$x = $imageheight/$tdheight;
$imagewidth = intval($imagewidth/$x);
$imageheight = $tdheight;
}
//그림 세로 출력수
if($sero < $imgsero)
{
echo("<td bgcolor=#f9f9f9 align=center valign=middle width=$tdwidth height=$tdheight><a href=\"javascript:void(window.open('$imagefile','','scrollbars=no,width=$imagewidth20,height=$imageheight20'))\" onFocus=\"this.blur()\"><img src=$imagefile width=$imagewidth height=$imageheight></a></td>\n");
$garo++;
//그림 가로 출력수
if($garo%$imggaro == 0)
{
$sero++;
if($sero != $imgsero)
{
echo("</tr>\n<tr>\n");
}
}
}
}
}
}
closedir($handle);
?>
</tr>
</table>
<!--소스끝-->
사용하기 편하고 업로드 방식이 계정에 직접 파일을 한꺼번에 올려주면..
해당폴더의 파일을 보여주는 형식 입니다.
제가 사용하게 된지가 오래 되어서 출처는 잘 모르겠습니다.
조금 불편하고 개선할 부분이 있어서 혹시 관심이 있는 분이 있으시면..
수정 부탁 드립니다.
-수정할 사항-
1) 썸레일 기능이 없습니다.
2) 이미지 클릭후 팝업창에서 원본이미지 클릭하면 윈도우가 닫혔으면 좋겠습니다.
현재사용하는 페이지 : http://lbw.kr/icon/icons.php
<!--소스시작-->
<?
//$code = 파일확장자
//$imagefile = 그림파일명
//$imagewidth = 이미지의 가로길이
//$imageheight = 이미지의 세로길이
//$page = 페이지번호
$tdwidth = 100; // 테이블 한칸의 가로길이
$tdheight = 100; // 테이블 한칸의 세로길이
$imggaro = 6; // 그림 가로 출력 갯수
$imgsero = 5; // 그림 세로 출력 갯수
$viewimg = $imggaro * $imgsero; // 한화면의 그림 출력 갯수
?>
<?
$handle=opendir("."); //시작할 폴더위치를 지정한다.
//그림파일 전체 갯수 구함
while ($imagefile = readdir($handle))
{
$code = substr($imagefile,-3); //확장자검색
if($code == jpg || $code == gif) //그림파일확인
{
$num++;
}
}
//echo("그림파일 : $num 개");
if($page == "" || $page == "0" || $page == "1")
{
$page = "1";
}
//NEXT , PREVIEW 만들기.
$next = $page+1;
$preview = $page-1;
if($page == 1)
{
//echo("[ 이전 ]");
//echo("<a href=$PHP_SELF?page=$next><b>[ 다음 ]</b></a> <br>");
}
else if($page == intval($num/$viewimg)+1)
{
//echo("<a href=$PHP_SELF?page=$preview><b>[ 이전 ]</b></a> ");
//echo("[ 다음 ]<br>");
}
else
{
//echo("<a href=$PHP_SELF?page=$preview><b>[ 이전 ]</b></a> ");
//echo("<a href=$PHP_SELF?page=$next><b>[ 다음 ]</b></a> <br>");
}
//페이지 설정
$for = intval($num/$viewimg)+1;
for($i=1; $i <= $for; $i++)
{
if($page == $i)
{
echo(" <a href=$PHP_SELF?page=$i><b>[$i]</b></a> ");
}
else
{
echo(" <a href=$PHP_SELF?page=$i>[$i]</a> ");
}
}
closedir($handle);
?>
<table width="100%" height="500" cellpadding="2" cellspacing="2" border="0">
<tr>
<?
$handle=opendir("."); //시작할 폴더위치를 지정한다.
while ($imagefile = readdir($handle))
{
$code = substr($imagefile,-3); //확장자검색
if($code == jpg || $code == gif) //그림파일확인
{
$k++;
if( $k > (($viewimg*$page)-$viewimg) && $k <= ($viewimg*$page)) //나타내야할 부분 추출 한다.
{
$imagehw = GetImageSize($imagefile); // 이미지 사이크를 구함.
$imagewidth = $imagehw[0]; // 이미지 가로길이
$imageheight = $imagehw[1]; // 이미지 세로길이
$imagewidth20 = $imagewidth+20;
$imageheight20 = $imageheight+20;
// 이미지 가로길이가 테이블 한칸 가로길이보다 클경우
if($imagewidth >= $tdwidth)
{
$x = $imagewidth/$tdwidth;
$imageheight = intval($imageheight/$x);
$imagewidth = $tdwidth;
}
// 이미지 세로길이가 테이블 한칸 세로길이보다 클경우
if($imageheight > $tdheight)
{
$x = $imageheight/$tdheight;
$imagewidth = intval($imagewidth/$x);
$imageheight = $tdheight;
}
//그림 세로 출력수
if($sero < $imgsero)
{
echo("<td bgcolor=#f9f9f9 align=center valign=middle width=$tdwidth height=$tdheight><a href=\"javascript:void(window.open('$imagefile','','scrollbars=no,width=$imagewidth20,height=$imageheight20'))\" onFocus=\"this.blur()\"><img src=$imagefile width=$imagewidth height=$imageheight></a></td>\n");
$garo++;
//그림 가로 출력수
if($garo%$imggaro == 0)
{
$sero++;
if($sero != $imgsero)
{
echo("</tr>\n<tr>\n");
}
}
}
}
}
}
closedir($handle);
?>
</tr>
</table>
<!--소스끝-->
[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]
댓글 2개
put777
17년 전
쵝오 !
16년 전
위에서 12번째줄의 시작폴더를 바꾸면 이미지가 나타나지 않네요...
그대로 쓰면 잘되는데.......
$handle=opendir("."); //시작할 폴더위치를 지정한다.
그대로 쓰면 잘되는데.......
$handle=opendir("."); //시작할 폴더위치를 지정한다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 8230 | 9년 전 | 119 | ||
| 8229 | 9년 전 | 117 | ||
| 8228 |
커네드커네드
|
9년 전 | 158 | |
| 8227 | 9년 전 | 201 | ||
| 8226 | 9년 전 | 214 | ||
| 8225 | 9년 전 | 196 | ||
| 8224 | 9년 전 | 190 | ||
| 8223 | 9년 전 | 168 | ||
| 8222 |
|
9년 전 | 244 | |
| 8221 | 9년 전 | 151 | ||
| 8220 | 9년 전 | 185 | ||
| 8219 | 9년 전 | 143 | ||
| 8218 | 9년 전 | 191 | ||
| 8217 |
star3840
|
9년 전 | 160 | |
| 8216 | 9년 전 | 230 | ||
| 8215 | 9년 전 | 180 | ||
| 8214 | 9년 전 | 280 | ||
| 8213 | 9년 전 | 231 | ||
| 8212 | 9년 전 | 146 | ||
| 8211 | 9년 전 | 317 | ||
| 8210 | 9년 전 | 326 | ||
| 8209 | 9년 전 | 397 | ||
| 8208 | 9년 전 | 288 | ||
| 8207 | 9년 전 | 291 | ||
| 8206 |
|
9년 전 | 245 | |
| 8205 | 9년 전 | 231 | ||
| 8204 | 9년 전 | 198 | ||
| 8203 | 9년 전 | 278 | ||
| 8202 | 9년 전 | 194 | ||
| 8201 | 9년 전 | 243 | ||
| 8200 | 9년 전 | 236 | ||
| 8199 | 9년 전 | 260 | ||
| 8198 | 9년 전 | 227 | ||
| 8197 | 9년 전 | 219 | ||
| 8196 | 9년 전 | 614 | ||
| 8195 | 9년 전 | 217 | ||
| 8194 | 9년 전 | 332 | ||
| 8193 | 9년 전 | 232 | ||
| 8192 | 9년 전 | 253 | ||
| 8191 | 9년 전 | 207 | ||
| 8190 | 9년 전 | 204 | ||
| 8189 | 9년 전 | 262 | ||
| 8188 | 9년 전 | 196 | ||
| 8187 | 9년 전 | 197 | ||
| 8186 | 9년 전 | 201 | ||
| 8185 | 9년 전 | 370 | ||
| 8184 | 9년 전 | 154 | ||
| 8183 | 9년 전 | 381 | ||
| 8182 | 9년 전 | 233 | ||
| 8181 | 9년 전 | 192 | ||
| 8180 | 9년 전 | 770 | ||
| 8179 | 9년 전 | 538 | ||
| 8178 | 9년 전 | 389 | ||
| 8177 |
kiplayer
|
9년 전 | 393 | |
| 8176 | 9년 전 | 422 | ||
| 8175 | 9년 전 | 301 | ||
| 8174 | 9년 전 | 303 | ||
| 8173 | 9년 전 | 397 | ||
| 8172 | 9년 전 | 261 | ||
| 8171 | 9년 전 | 235 | ||
| 8170 | 9년 전 | 359 | ||
| 8169 |
커네드커네드
|
9년 전 | 310 | |
| 8168 | 9년 전 | 380 | ||
| 8167 | 9년 전 | 375 | ||
| 8166 | 9년 전 | 282 | ||
| 8165 | 9년 전 | 226 | ||
| 8164 | 9년 전 | 363 | ||
| 8163 | 9년 전 | 353 | ||
| 8162 | 9년 전 | 360 | ||
| 8161 | 9년 전 | 372 | ||
| 8160 |
|
9년 전 | 565 | |
| 8159 | 9년 전 | 507 | ||
| 8158 | 9년 전 | 316 | ||
| 8157 | 9년 전 | 429 | ||
| 8156 | 9년 전 | 313 | ||
| 8155 | 9년 전 | 306 | ||
| 8154 |
00년생용띠
|
9년 전 | 647 | |
| 8153 | 9년 전 | 285 | ||
| 8152 |
|
9년 전 | 472 | |
| 8151 | 9년 전 | 466 | ||
| 8150 | 9년 전 | 574 | ||
| 8149 |
Jangfolk
|
9년 전 | 421 | |
| 8148 | 9년 전 | 239 | ||
| 8147 | 9년 전 | 440 | ||
| 8146 | 9년 전 | 516 | ||
| 8145 | 9년 전 | 468 | ||
| 8144 | 9년 전 | 429 | ||
| 8143 | 9년 전 | 262 | ||
| 8142 | 9년 전 | 486 | ||
| 8141 | 9년 전 | 432 | ||
| 8140 | 9년 전 | 981 | ||
| 8139 | 9년 전 | 333 | ||
| 8138 |
전갈자리남자
|
9년 전 | 440 | |
| 8137 | 9년 전 | 474 | ||
| 8136 | 9년 전 | 805 | ||
| 8135 |
|
9년 전 | 841 | |
| 8134 |
PlayPixel
|
9년 전 | 581 | |
| 8133 |
|
9년 전 | 496 | |
| 8132 | 9년 전 | 520 | ||
| 8131 | 9년 전 | 881 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기