아래소스는 디렉토리 내의 이미지보기(겔러리) 소스 입니다.
사용하기 편하고 업로드 방식이 계정에 직접 파일을 한꺼번에 올려주면..
해당폴더의 파일을 보여주는 형식 입니다.
제가 사용하게 된지가 오래 되어서 출처는 잘 모르겠습니다.
조금 불편하고 개선할 부분이 있어서 혹시 관심이 있는 분이 있으시면..
수정 부탁 드립니다.
-수정할 사항-
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("."); //시작할 폴더위치를 지정한다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1230 |
|
18년 전 | 2016 | |
| 1229 |
|
18년 전 | 2953 | |
| 1228 |
|
18년 전 | 2638 | |
| 1227 | 18년 전 | 2935 | ||
| 1226 | 18년 전 | 2366 | ||
| 1225 |
|
18년 전 | 2441 | |
| 1224 | 18년 전 | 2751 | ||
| 1223 |
|
18년 전 | 3999 | |
| 1222 |
mixdesign
|
18년 전 | 2638 | |
| 1221 |
|
18년 전 | 2758 | |
| 1220 | 18년 전 | 3215 | ||
| 1219 | 18년 전 | 2922 | ||
| 1218 | 18년 전 | 2117 | ||
| 1217 |
|
18년 전 | 2561 | |
| 1216 | 18년 전 | 2582 | ||
| 1215 |
mixdesign
|
18년 전 | 4064 | |
| 1214 |
|
18년 전 | 4793 | |
| 1213 | 18년 전 | 2327 | ||
| 1212 |
mixdesign
|
18년 전 | 2510 | |
| 1211 |
|
18년 전 | 2434 | |
| 1210 | 18년 전 | 3763 | ||
| 1209 |
mixdesign
|
18년 전 | 2379 | |
| 1208 |
mixdesign
|
18년 전 | 2381 | |
| 1207 |
mixdesign
|
18년 전 | 1732 | |
| 1206 |
mixdesign
|
18년 전 | 2010 | |
| 1205 |
mixdesign
|
18년 전 | 2705 | |
| 1204 |
mixdesign
|
18년 전 | 3582 | |
| 1203 | 18년 전 | 3102 | ||
| 1202 | 18년 전 | 2984 | ||
| 1201 | 18년 전 | 2037 | ||
| 1200 | 18년 전 | 4134 | ||
| 1199 | 18년 전 | 2176 | ||
| 1198 | 18년 전 | 4198 | ||
| 1197 | 18년 전 | 2512 | ||
| 1196 | 18년 전 | 2372 | ||
| 1195 |
|
18년 전 | 3475 | |
| 1194 | 18년 전 | 2248 | ||
| 1193 | 18년 전 | 2157 | ||
| 1192 | 18년 전 | 3277 | ||
| 1191 | 18년 전 | 3966 | ||
| 1190 | 18년 전 | 2231 | ||
| 1189 |
|
18년 전 | 2371 | |
| 1188 |
|
18년 전 | 3839 | |
| 1187 | 18년 전 | 2720 | ||
| 1186 | 18년 전 | 3386 | ||
| 1185 | 18년 전 | 2791 | ||
| 1184 | 18년 전 | 1672 | ||
| 1183 | 18년 전 | 2145 | ||
| 1182 | 18년 전 | 3713 | ||
| 1181 |
mermaid
|
18년 전 | 2926 | |
| 1180 | 18년 전 | 2987 | ||
| 1179 | 18년 전 | 3616 | ||
| 1178 | 18년 전 | 2179 | ||
| 1177 |
|
18년 전 | 2294 | |
| 1176 | 18년 전 | 3182 | ||
| 1175 | 18년 전 | 1884 | ||
| 1174 |
|
18년 전 | 2240 | |
| 1173 |
|
18년 전 | 2530 | |
| 1172 | 18년 전 | 1777 | ||
| 1171 | 18년 전 | 2113 | ||
| 1170 | 18년 전 | 1995 | ||
| 1169 | 18년 전 | 2509 | ||
| 1168 | 18년 전 | 1936 | ||
| 1167 | 18년 전 | 1732 | ||
| 1166 | 18년 전 | 1756 | ||
| 1165 | 18년 전 | 1734 | ||
| 1164 | 18년 전 | 2804 | ||
| 1163 | 18년 전 | 1562 | ||
| 1162 |
|
18년 전 | 5680 | |
| 1161 |
이걸~어쩌나~
|
18년 전 | 2414 | |
| 1160 | 18년 전 | 1674 | ||
| 1159 | 18년 전 | 4706 | ||
| 1158 | 18년 전 | 2057 | ||
| 1157 | 18년 전 | 4847 | ||
| 1156 | 18년 전 | 3195 | ||
| 1155 | 18년 전 | 2137 | ||
| 1154 | 18년 전 | 1835 | ||
| 1153 |
BEST79
|
18년 전 | 2116 | |
| 1152 | 18년 전 | 1733 | ||
| 1151 | 18년 전 | 1849 | ||
| 1150 | 18년 전 | 1853 | ||
| 1149 |
inniskun
|
18년 전 | 2486 | |
| 1148 |
|
18년 전 | 3507 | |
| 1147 |
|
18년 전 | 5981 | |
| 1146 |
|
18년 전 | 3871 | |
| 1145 | 18년 전 | 3064 | ||
| 1144 | 18년 전 | 2146 | ||
| 1143 | 18년 전 | 2423 | ||
| 1142 | 18년 전 | 2207 | ||
| 1141 |
|
18년 전 | 2310 | |
| 1140 | 18년 전 | 2419 | ||
| 1139 | 18년 전 | 2850 | ||
| 1138 | 18년 전 | 2543 | ||
| 1137 | 18년 전 | 2004 | ||
| 1136 | 18년 전 | 3134 | ||
| 1135 | 18년 전 | 3598 | ||
| 1134 | 18년 전 | 3841 | ||
| 1133 |
자반고등어
|
18년 전 | 3351 | |
| 1132 | 18년 전 | 3400 | ||
| 1131 | 18년 전 | 2579 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기