아래소스는 디렉토리 내의 이미지보기(겔러리) 소스 입니다.
사용하기 편하고 업로드 방식이 계정에 직접 파일을 한꺼번에 올려주면..
해당폴더의 파일을 보여주는 형식 입니다.
제가 사용하게 된지가 오래 되어서 출처는 잘 모르겠습니다.
조금 불편하고 개선할 부분이 있어서 혹시 관심이 있는 분이 있으시면..
수정 부탁 드립니다.
-수정할 사항-
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개
게시글 목록
| 번호 | 제목 |
|---|---|
| 8050 | |
| 8048 | |
| 19969 |
MySQL
mysql 상태를 확인 하는 방법
|
| 19968 |
MySQL
mysql 실시간 processlist
|
| 19967 | |
| 19966 | |
| 19965 |
MySQL
mysql 일반적인 최적화 팁
|
| 19964 |
기타
간단한 리눅스 명령어
|
| 19963 | |
| 19962 |
MySQL
mysql 데이터 경로 바꾸기
|
| 19961 |
MySQL
mysql 운영팁. 느린 쿼리를 발견하기
|
| 28345 | |
| 31017 | |
| 19960 | |
| 19959 |
MySQL
mysql index에 대해..
|
| 19958 |
MySQL
구분자는 enum으로
|
| 19957 |
MySQL
mysql zerofill에 대해
|
| 8039 | |
| 8035 | |
| 8029 | |
| 28344 | |
| 28339 | |
| 8019 | |
| 28338 | |
| 8017 | |
| 8010 | |
| 8007 | |
| 8004 | |
| 8003 | |
| 28332 | |
| 28322 | |
| 7999 | |
| 28317 | |
| 20956 | |
| 7992 | |
| 20945 | |
| 28314 | |
| 20936 | |
| 20931 | |
| 7986 | |
| 20925 | |
| 7982 | |
| 7979 | |
| 7978 | |
| 7975 | |
| 28307 | |
| 7973 | |
| 7966 | |
| 28305 | |
| 7963 | |
| 28300 | |
| 7961 | |
| 28297 | |
| 28295 | |
| 7959 | |
| 19948 | |
| 19947 | |
| 28292 | |
| 31016 | |
| 19946 | |
| 19945 | |
| 28286 | |
| 7958 | |
| 7956 | |
| 7952 | |
| 7946 | |
| 28285 | |
| 28283 | |
| 19943 | |
| 7944 | |
| 7936 | |
| 7931 | |
| 28279 | |
| 24666 | |
| 24663 | |
| 7928 | |
| 7923 | |
| 19941 |
MySQL
phpMyAdmin 시간 늘리기
1
|
| 28274 | |
| 28257 | |
| 28249 | |
| 28248 | |
| 7914 | |
| 7912 | |
| 7911 | |
| 20912 | |
| 7908 | |
| 31755 |
부트스트랩
부트스트랩 MIT 라이센스?
4
|
| 28233 | |
| 28232 | |
| 28228 | |
| 7903 | |
| 28217 | |
| 20900 | |
| 24662 | |
| 20891 | |
| 20882 | |
| 19936 | |
| 20853 | |
| 31011 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기