아래소스는 디렉토리 내의 이미지보기(겔러리) 소스 입니다.
사용하기 편하고 업로드 방식이 계정에 직접 파일을 한꺼번에 올려주면..
해당폴더의 파일을 보여주는 형식 입니다.
제가 사용하게 된지가 오래 되어서 출처는 잘 모르겠습니다.
조금 불편하고 개선할 부분이 있어서 혹시 관심이 있는 분이 있으시면..
수정 부탁 드립니다.
-수정할 사항-
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("."); //시작할 폴더위치를 지정한다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 2230 | 16년 전 | 1288 | ||
| 2229 | 16년 전 | 2160 | ||
| 2228 | 16년 전 | 3222 | ||
| 2227 | 16년 전 | 2165 | ||
| 2226 | 16년 전 | 1747 | ||
| 2225 | 16년 전 | 1507 | ||
| 2224 |
|
16년 전 | 2042 | |
| 2223 | 16년 전 | 4723 | ||
| 2222 | 16년 전 | 1405 | ||
| 2221 |
|
16년 전 | 2142 | |
| 2220 |
|
16년 전 | 2131 | |
| 2219 |
|
16년 전 | 2400 | |
| 2218 |
|
16년 전 | 2144 | |
| 2217 |
|
16년 전 | 4434 | |
| 2216 |
|
16년 전 | 2921 | |
| 2215 | 16년 전 | 2862 | ||
| 2214 | 16년 전 | 1594 | ||
| 2213 | 16년 전 | 1235 | ||
| 2212 |
|
16년 전 | 3941 | |
| 2211 |
|
16년 전 | 1613 | |
| 2210 |
|
16년 전 | 1602 | |
| 2209 | 16년 전 | 2106 | ||
| 2208 | 16년 전 | 1878 | ||
| 2207 |
letsgolee
|
16년 전 | 1489 | |
| 2206 |
|
16년 전 | 3913 | |
| 2205 | 16년 전 | 1753 | ||
| 2204 | 16년 전 | 3133 | ||
| 2203 | 16년 전 | 3018 | ||
| 2202 | 16년 전 | 1040 | ||
| 2201 | 16년 전 | 1844 | ||
| 2200 | 16년 전 | 1589 | ||
| 2199 |
|
16년 전 | 1849 | |
| 2198 |
태양의서쪽
|
16년 전 | 2634 | |
| 2197 |
태양의서쪽
|
16년 전 | 3015 | |
| 2196 |
태양의서쪽
|
16년 전 | 3218 | |
| 2195 | 16년 전 | 3324 | ||
| 2194 | 16년 전 | 1459 | ||
| 2193 |
letsgolee
|
16년 전 | 1417 | |
| 2192 | 16년 전 | 2253 | ||
| 2191 | 16년 전 | 1972 | ||
| 2190 |
|
16년 전 | 2287 | |
| 2189 | 16년 전 | 2808 | ||
| 2188 |
Sizkein
|
16년 전 | 3260 | |
| 2187 |
letsgolee
|
16년 전 | 2356 | |
| 2186 |
Sizkein
|
16년 전 | 1632 | |
| 2185 |
Sizkein
|
16년 전 | 3203 | |
| 2184 |
Sizkein
|
16년 전 | 3061 | |
| 2183 | 16년 전 | 3039 | ||
| 2182 | 16년 전 | 3907 | ||
| 2181 | 16년 전 | 2579 | ||
| 2180 |
|
16년 전 | 2401 | |
| 2179 | 16년 전 | 2650 | ||
| 2178 | 16년 전 | 2893 | ||
| 2177 | 17년 전 | 2612 | ||
| 2176 | 17년 전 | 1451 | ||
| 2175 | 17년 전 | 1891 | ||
| 2174 | 17년 전 | 1485 | ||
| 2173 |
|
17년 전 | 1910 | |
| 2172 | 17년 전 | 2507 | ||
| 2171 | 17년 전 | 8691 | ||
| 2170 | 17년 전 | 3149 | ||
| 2169 | 17년 전 | 4236 | ||
| 2168 |
|
17년 전 | 1976 | |
| 2167 | 17년 전 | 3655 | ||
| 2166 |
|
17년 전 | 1546 | |
| 2165 | 17년 전 | 1383 | ||
| 2164 | 17년 전 | 2319 | ||
| 2163 | 17년 전 | 1314 | ||
| 2162 | 17년 전 | 1635 | ||
| 2161 | 17년 전 | 1454 | ||
| 2160 | 17년 전 | 2525 | ||
| 2159 |
inxps
|
17년 전 | 1491 | |
| 2158 |
inxps
|
17년 전 | 1091 | |
| 2157 | 17년 전 | 1220 | ||
| 2156 | 17년 전 | 3093 | ||
| 2155 | 17년 전 | 2164 | ||
| 2154 | 17년 전 | 1969 | ||
| 2153 |
|
17년 전 | 1219 | |
| 2152 |
letsgolee
|
17년 전 | 2453 | |
| 2151 | 17년 전 | 1169 | ||
| 2150 |
아름다운세상
|
17년 전 | 1124 | |
| 2149 |
아름다운세상
|
17년 전 | 1367 | |
| 2148 |
아름다운세상
|
17년 전 | 2732 | |
| 2147 |
|
17년 전 | 2396 | |
| 2146 | 17년 전 | 2482 | ||
| 2145 | 17년 전 | 1183 | ||
| 2144 | 17년 전 | 1300 | ||
| 2143 | 17년 전 | 3241 | ||
| 2142 | 17년 전 | 2830 | ||
| 2141 | 17년 전 | 4107 | ||
| 2140 | 17년 전 | 2256 | ||
| 2139 | 17년 전 | 2346 | ||
| 2138 | 17년 전 | 1394 | ||
| 2137 | 17년 전 | 2513 | ||
| 2136 | 17년 전 | 2200 | ||
| 2135 | 17년 전 | 2959 | ||
| 2134 |
아름다운세상
|
17년 전 | 2468 | |
| 2133 |
Juinjang
|
17년 전 | 1629 | |
| 2132 | 17년 전 | 2429 | ||
| 2131 | 17년 전 | 1588 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기