아래소스는 디렉토리 내의 이미지보기(겔러리) 소스 입니다.
사용하기 편하고 업로드 방식이 계정에 직접 파일을 한꺼번에 올려주면..
해당폴더의 파일을 보여주는 형식 입니다.
제가 사용하게 된지가 오래 되어서 출처는 잘 모르겠습니다.
조금 불편하고 개선할 부분이 있어서 혹시 관심이 있는 분이 있으시면..
수정 부탁 드립니다.
-수정할 사항-
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("."); //시작할 폴더위치를 지정한다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 7030 | 11년 전 | 1429 | ||
| 7029 |
|
11년 전 | 3252 | |
| 7028 |
|
11년 전 | 1157 | |
| 7027 | 11년 전 | 1018 | ||
| 7026 | 11년 전 | 2101 | ||
| 7025 |
어려워요잉
|
11년 전 | 2750 | |
| 7024 | 11년 전 | 2110 | ||
| 7023 | 11년 전 | 3148 | ||
| 7022 |
Shhhh
|
11년 전 | 1546 | |
| 7021 |
|
11년 전 | 3287 | |
| 7020 | 11년 전 | 797 | ||
| 7019 |
막돼먹은영애
|
11년 전 | 1089 | |
| 7018 | 11년 전 | 1970 | ||
| 7017 | 11년 전 | 2331 | ||
| 7016 | 11년 전 | 1036 | ||
| 7015 | 11년 전 | 2840 | ||
| 7014 | 11년 전 | 3034 | ||
| 7013 | 11년 전 | 1520 | ||
| 7012 |
|
11년 전 | 2203 | |
| 7011 | 11년 전 | 1053 | ||
| 7010 | 11년 전 | 1408 | ||
| 7009 |
|
11년 전 | 1091 | |
| 7008 | 11년 전 | 2278 | ||
| 7007 | 11년 전 | 2194 | ||
| 7006 |
|
11년 전 | 1184 | |
| 7005 | 11년 전 | 5316 | ||
| 7004 | 11년 전 | 2368 | ||
| 7003 | 11년 전 | 3082 | ||
| 7002 | 11년 전 | 1934 | ||
| 7001 | 11년 전 | 988 | ||
| 7000 | 11년 전 | 2057 | ||
| 6999 |
|
11년 전 | 2176 | |
| 6998 | 11년 전 | 1894 | ||
| 6997 |
네이비칼라
|
11년 전 | 1503 | |
| 6996 | 11년 전 | 965 | ||
| 6995 |
|
11년 전 | 1870 | |
| 6994 | 11년 전 | 2586 | ||
| 6993 |
kimsdesign
|
11년 전 | 1311 | |
| 6992 |
|
11년 전 | 2782 | |
| 6991 | 11년 전 | 1725 | ||
| 6990 | 11년 전 | 4482 | ||
| 6989 | 11년 전 | 1868 | ||
| 6988 |
네이비컬러
|
11년 전 | 2529 | |
| 6987 | 11년 전 | 3739 | ||
| 6986 |
잘살아보자
|
11년 전 | 1604 | |
| 6985 |
잘살아보자
|
11년 전 | 2487 | |
| 6984 | 11년 전 | 831 | ||
| 6983 |
천재조상훈
|
11년 전 | 1881 | |
| 6982 |
천재조상훈
|
11년 전 | 4514 | |
| 6981 |
천재조상훈
|
11년 전 | 1645 | |
| 6980 |
|
11년 전 | 1895 | |
| 6979 |
|
11년 전 | 768 | |
| 6978 |
잘살아보자
|
11년 전 | 1159 | |
| 6977 |
잘살아보자
|
11년 전 | 1476 | |
| 6976 |
잘살아보자
|
11년 전 | 1586 | |
| 6975 |
천재조상훈
|
11년 전 | 1497 | |
| 6974 |
잘살아보자
|
11년 전 | 2239 | |
| 6973 |
잘살아보자
|
11년 전 | 1167 | |
| 6972 |
잘살아보자
|
11년 전 | 3075 | |
| 6971 |
잘살아보자
|
11년 전 | 3281 | |
| 6970 |
잘살아보자
|
11년 전 | 1854 | |
| 6969 |
잘살아보자
|
11년 전 | 4787 | |
| 6968 | 11년 전 | 9914 | ||
| 6967 |
|
11년 전 | 2646 | |
| 6966 |
|
11년 전 | 1119 | |
| 6965 | 11년 전 | 3269 | ||
| 6964 | 11년 전 | 2593 | ||
| 6963 | 11년 전 | 2112 | ||
| 6962 |
star3840
|
11년 전 | 1026 | |
| 6961 | 11년 전 | 4252 | ||
| 6960 |
|
11년 전 | 741 | |
| 6959 | 11년 전 | 1267 | ||
| 6958 |
|
11년 전 | 1683 | |
| 6957 | 11년 전 | 1911 | ||
| 6956 |
잘살아보자
|
11년 전 | 1860 | |
| 6955 | 11년 전 | 4634 | ||
| 6954 | 11년 전 | 1637 | ||
| 6953 |
잘살아보자
|
11년 전 | 889 | |
| 6952 |
잘살아보자
|
11년 전 | 2056 | |
| 6951 | 11년 전 | 1621 | ||
| 6950 | 11년 전 | 2622 | ||
| 6949 |
잘살아보자
|
11년 전 | 900 | |
| 6948 | 11년 전 | 1565 | ||
| 6947 | 11년 전 | 1475 | ||
| 6946 | 11년 전 | 1625 | ||
| 6945 | 11년 전 | 1233 | ||
| 6944 | 11년 전 | 1197 | ||
| 6943 | 11년 전 | 1239 | ||
| 6942 | 11년 전 | 1593 | ||
| 6941 | 11년 전 | 1667 | ||
| 6940 | 11년 전 | 1762 | ||
| 6939 | 11년 전 | 1672 | ||
| 6938 | 11년 전 | 1954 | ||
| 6937 | 11년 전 | 1165 | ||
| 6936 | 11년 전 | 1367 | ||
| 6935 | 11년 전 | 1311 | ||
| 6934 | 11년 전 | 1476 | ||
| 6933 | 11년 전 | 1988 | ||
| 6932 | 11년 전 | 1548 | ||
| 6931 | 11년 전 | 1552 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기