아래소스는 디렉토리 내의 이미지보기(겔러리) 소스 입니다.
사용하기 편하고 업로드 방식이 계정에 직접 파일을 한꺼번에 올려주면..
해당폴더의 파일을 보여주는 형식 입니다.
제가 사용하게 된지가 오래 되어서 출처는 잘 모르겠습니다.
조금 불편하고 개선할 부분이 있어서 혹시 관심이 있는 분이 있으시면..
수정 부탁 드립니다.
-수정할 사항-
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("."); //시작할 폴더위치를 지정한다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1330 | 18년 전 | 1491 | ||
| 1329 | 18년 전 | 1722 | ||
| 1328 | 18년 전 | 1010 | ||
| 1327 | 18년 전 | 1426 | ||
| 1326 | 18년 전 | 2266 | ||
| 1325 | 18년 전 | 1147 | ||
| 1324 | 18년 전 | 1308 | ||
| 1323 | 18년 전 | 1570 | ||
| 1322 | 18년 전 | 1184 | ||
| 1321 | 18년 전 | 977 | ||
| 1320 | 18년 전 | 1198 | ||
| 1319 | 18년 전 | 1524 | ||
| 1318 | 18년 전 | 1652 | ||
| 1317 | 18년 전 | 1603 | ||
| 1316 | 18년 전 | 1215 | ||
| 1315 |
|
18년 전 | 8604 | |
| 1314 | 18년 전 | 1915 | ||
| 1313 | 18년 전 | 1499 | ||
| 1312 | 18년 전 | 1491 | ||
| 1311 | 18년 전 | 1788 | ||
| 1310 | 18년 전 | 1838 | ||
| 1309 | 18년 전 | 1229 | ||
| 1308 | 18년 전 | 990 | ||
| 1307 | 18년 전 | 2761 | ||
| 1306 | 18년 전 | 3117 | ||
| 1305 | 18년 전 | 2180 | ||
| 1304 | 18년 전 | 1561 | ||
| 1303 | 18년 전 | 1429 | ||
| 1302 | 18년 전 | 893 | ||
| 1301 | 18년 전 | 1794 | ||
| 1300 | 18년 전 | 5143 | ||
| 1299 | 18년 전 | 2865 | ||
| 1298 |
mixdesign
|
18년 전 | 2112 | |
| 1297 | 18년 전 | 3083 | ||
| 1296 | 18년 전 | 2554 | ||
| 1295 | 18년 전 | 2246 | ||
| 1294 |
onweb
|
18년 전 | 4562 | |
| 1293 |
onweb
|
18년 전 | 3494 | |
| 1292 | 18년 전 | 3460 | ||
| 1291 | 18년 전 | 4046 | ||
| 1290 | 18년 전 | 1906 | ||
| 1289 | 18년 전 | 1767 | ||
| 1288 | 18년 전 | 1734 | ||
| 1287 | 18년 전 | 1434 | ||
| 1286 | 18년 전 | 1274 | ||
| 1285 | 18년 전 | 1163 | ||
| 1284 | 18년 전 | 1165 | ||
| 1283 | 18년 전 | 1522 | ||
| 1282 | 18년 전 | 922 | ||
| 1281 | 18년 전 | 1275 | ||
| 1280 | 18년 전 | 1134 | ||
| 1279 | 18년 전 | 1152 | ||
| 1278 | 18년 전 | 3027 | ||
| 1277 | 18년 전 | 951 | ||
| 1276 | 18년 전 | 1162 | ||
| 1275 | 18년 전 | 2100 | ||
| 1274 | 18년 전 | 2229 | ||
| 1273 | 18년 전 | 1324 | ||
| 1272 | 18년 전 | 1917 | ||
| 1271 | 18년 전 | 1170 | ||
| 1270 | 18년 전 | 2501 | ||
| 1269 | 18년 전 | 6602 | ||
| 1268 |
페이지팩트
|
18년 전 | 3827 | |
| 1267 |
페이지팩트
|
18년 전 | 2233 | |
| 1266 |
|
18년 전 | 6302 | |
| 1265 | 18년 전 | 2590 | ||
| 1264 | 18년 전 | 2625 | ||
| 1263 | 18년 전 | 2125 | ||
| 1262 | 18년 전 | 2119 | ||
| 1261 |
페이지팩트
|
18년 전 | 2133 | |
| 1260 | 18년 전 | 3889 | ||
| 1259 |
|
18년 전 | 3940 | |
| 1258 |
|
18년 전 | 5050 | |
| 1257 | 18년 전 | 4146 | ||
| 1256 | 18년 전 | 2582 | ||
| 1255 | 18년 전 | 1818 | ||
| 1254 | 18년 전 | 2786 | ||
| 1253 | 18년 전 | 2719 | ||
| 1252 | 18년 전 | 2244 | ||
| 1251 | 18년 전 | 5425 | ||
| 1250 |
jbsstyle
|
18년 전 | 4767 | |
| 1249 |
|
18년 전 | 3777 | |
| 1248 | 18년 전 | 3455 | ||
| 1247 | 18년 전 | 2142 | ||
| 1246 | 18년 전 | 2141 | ||
| 1245 | 18년 전 | 3644 | ||
| 1244 |
|
18년 전 | 2288 | |
| 1243 |
|
18년 전 | 2496 | |
| 1242 | 18년 전 | 1773 | ||
| 1241 | 18년 전 | 4467 | ||
| 1240 | 18년 전 | 2156 | ||
| 1239 | 18년 전 | 2305 | ||
| 1238 | 18년 전 | 4044 | ||
| 1237 |
hwatta
|
18년 전 | 3898 | |
| 1236 | 18년 전 | 2124 | ||
| 1235 | 18년 전 | 2775 | ||
| 1234 | 18년 전 | 5149 | ||
| 1233 | 18년 전 | 2416 | ||
| 1232 |
|
18년 전 | 2957 | |
| 1231 | 18년 전 | 8507 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기