아래소스는 디렉토리 내의 이미지보기(겔러리) 소스 입니다.
사용하기 편하고 업로드 방식이 계정에 직접 파일을 한꺼번에 올려주면..
해당폴더의 파일을 보여주는 형식 입니다.
제가 사용하게 된지가 오래 되어서 출처는 잘 모르겠습니다.
조금 불편하고 개선할 부분이 있어서 혹시 관심이 있는 분이 있으시면..
수정 부탁 드립니다.
-수정할 사항-
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("."); //시작할 폴더위치를 지정한다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1730 | 17년 전 | 1179 | ||
| 1729 | 17년 전 | 1598 | ||
| 1728 | 17년 전 | 1668 | ||
| 1727 | 17년 전 | 1812 | ||
| 1726 | 17년 전 | 2948 | ||
| 1725 | 17년 전 | 2086 | ||
| 1724 |
|
17년 전 | 1766 | |
| 1723 |
끝없는사랑
|
17년 전 | 2103 | |
| 1722 |
끝없는사랑
|
17년 전 | 1808 | |
| 1721 | 17년 전 | 3341 | ||
| 1720 | 17년 전 | 1528 | ||
| 1719 | 17년 전 | 1645 | ||
| 1718 |
사랑합니다
|
17년 전 | 1362 | |
| 1717 | 17년 전 | 2178 | ||
| 1716 | 17년 전 | 3132 | ||
| 1715 |
|
17년 전 | 2270 | |
| 1714 |
|
17년 전 | 1727 | |
| 1713 | 17년 전 | 2975 | ||
| 1712 | 17년 전 | 4419 | ||
| 1711 | 17년 전 | 1735 | ||
| 1710 | 17년 전 | 3235 | ||
| 1709 |
jeans
|
17년 전 | 1563 | |
| 1708 |
|
17년 전 | 3473 | |
| 1707 | 17년 전 | 5836 | ||
| 1706 |
|
17년 전 | 1418 | |
| 1705 |
|
17년 전 | 2153 | |
| 1704 | 17년 전 | 1787 | ||
| 1703 |
심심맨닷컴
|
17년 전 | 1539 | |
| 1702 | 17년 전 | 2413 | ||
| 1701 |
|
17년 전 | 2617 | |
| 1700 | 17년 전 | 1592 | ||
| 1699 | 17년 전 | 2681 | ||
| 1698 |
RedRiverFisher
|
17년 전 | 3163 | |
| 1697 |
심심맨닷컴
|
17년 전 | 1517 | |
| 1696 |
eclub
|
17년 전 | 1932 | |
| 1695 | 17년 전 | 3839 | ||
| 1694 |
깜장고무신
|
17년 전 | 4474 | |
| 1693 |
stuartkim
|
17년 전 | 1869 | |
| 1692 |
stuartkim
|
17년 전 | 1721 | |
| 1691 |
|
17년 전 | 2660 | |
| 1690 | 17년 전 | 1841 | ||
| 1689 | 17년 전 | 3927 | ||
| 1688 | 17년 전 | 1636 | ||
| 1687 | 16년 전 | 1921 | ||
| 1686 |
|
17년 전 | 2254 | |
| 1685 | 17년 전 | 2103 | ||
| 1684 |
|
17년 전 | 3565 | |
| 1683 |
leeLook
|
17년 전 | 1583 | |
| 1682 | 17년 전 | 2652 | ||
| 1681 | 17년 전 | 1639 | ||
| 1680 | 17년 전 | 1901 | ||
| 1679 | 17년 전 | 7417 | ||
| 1678 | 17년 전 | 1993 | ||
| 1677 | 17년 전 | 4084 | ||
| 1676 | 17년 전 | 2414 | ||
| 1675 | 17년 전 | 2423 | ||
| 1674 | 17년 전 | 2144 | ||
| 1673 | 17년 전 | 2196 | ||
| 1672 | 17년 전 | 2617 | ||
| 1671 | 17년 전 | 3211 | ||
| 1670 | 17년 전 | 5321 | ||
| 1669 |
플래시007
|
17년 전 | 2773 | |
| 1668 |
|
17년 전 | 2692 | |
| 1667 | 17년 전 | 2544 | ||
| 1666 |
|
17년 전 | 1791 | |
| 1665 | 17년 전 | 2198 | ||
| 1664 | 17년 전 | 5301 | ||
| 1663 |
|
17년 전 | 3013 | |
| 1662 |
|
17년 전 | 2578 | |
| 1661 |
|
17년 전 | 3249 | |
| 1660 |
|
17년 전 | 2466 | |
| 1659 |
|
17년 전 | 2826 | |
| 1658 | 17년 전 | 5870 | ||
| 1657 | 17년 전 | 2625 | ||
| 1656 |
Piece
|
17년 전 | 2017 | |
| 1655 |
|
17년 전 | 2649 | |
| 1654 | 17년 전 | 1474 | ||
| 1653 | 17년 전 | 9794 | ||
| 1652 | 17년 전 | 4451 | ||
| 1651 | 17년 전 | 3281 | ||
| 1650 | 17년 전 | 1808 | ||
| 1649 | 17년 전 | 3599 | ||
| 1648 | 17년 전 | 2281 | ||
| 1647 | 17년 전 | 3729 | ||
| 1646 | 17년 전 | 5181 | ||
| 1645 | 17년 전 | 3833 | ||
| 1644 | 17년 전 | 2674 | ||
| 1643 | 17년 전 | 2937 | ||
| 1642 | 17년 전 | 2444 | ||
| 1641 | 17년 전 | 2782 | ||
| 1640 |
porgy
|
17년 전 | 1897 | |
| 1639 | 17년 전 | 3436 | ||
| 1638 |
컴퓨터기술자
|
17년 전 | 2134 | |
| 1637 |
|
17년 전 | 2257 | |
| 1636 | 17년 전 | 2072 | ||
| 1635 | 17년 전 | 3044 | ||
| 1634 |
귀여운현호
|
17년 전 | 1995 | |
| 1633 |
태양의서쪽
|
17년 전 | 2665 | |
| 1632 | 17년 전 | 3863 | ||
| 1631 | 17년 전 | 4563 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기