아래소스는 디렉토리 내의 이미지보기(겔러리) 소스 입니다.
사용하기 편하고 업로드 방식이 계정에 직접 파일을 한꺼번에 올려주면..
해당폴더의 파일을 보여주는 형식 입니다.
제가 사용하게 된지가 오래 되어서 출처는 잘 모르겠습니다.
조금 불편하고 개선할 부분이 있어서 혹시 관심이 있는 분이 있으시면..
수정 부탁 드립니다.
-수정할 사항-
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개
게시글 목록
| 번호 | 제목 |
|---|---|
| 32341 | |
| 32339 | |
| 32326 | |
| 32325 | |
| 32322 | |
| 32319 | |
| 32318 | |
| 32316 | |
| 32315 | |
| 32313 | |
| 32312 | |
| 32311 | |
| 32310 | |
| 32304 | |
| 32303 | |
| 32300 | |
| 32293 | |
| 32292 | |
| 32291 | |
| 32285 | |
| 32284 | |
| 32275 | |
| 32271 | |
| 32268 | |
| 32265 | |
| 32261 | |
| 32258 | |
| 32257 | |
| 32255 | |
| 32254 | |
| 32253 | |
| 32251 | |
| 32250 | |
| 32249 | |
| 32247 | |
| 32246 | |
| 32245 | |
| 32244 | |
| 32243 | |
| 32242 | |
| 32241 | |
| 32240 | |
| 32239 | |
| 32238 | |
| 32237 | |
| 32236 | |
| 32232 | |
| 32229 | |
| 32228 | |
| 32227 | |
| 32217 | |
| 32215 | |
| 32214 | |
| 32213 | |
| 32211 | |
| 32207 | |
| 32196 | |
| 32193 | |
| 32192 | |
| 32190 | |
| 32188 | |
| 32186 | |
| 32184 | |
| 32173 | |
| 32172 | |
| 32171 | |
| 32167 | |
| 32165 | |
| 32163 | |
| 32162 | |
| 32158 | |
| 32157 | |
| 32155 | |
| 32151 | |
| 32149 | |
| 32135 | |
| 32132 | |
| 32127 | |
| 32125 | |
| 32122 | |
| 32120 | |
| 32119 | |
| 32117 | |
| 32116 | |
| 32115 | |
| 32114 | |
| 32112 | |
| 32111 | |
| 32109 | |
| 32107 | |
| 32104 | |
| 32103 | |
| 32102 | |
| 32101 | |
| 32094 | |
| 32089 | |
| 20404 | |
| 31036 | |
| 8279 | |
| 8268 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기