아래소스는 디렉토리 내의 이미지보기(겔러리) 소스 입니다.
사용하기 편하고 업로드 방식이 계정에 직접 파일을 한꺼번에 올려주면..
해당폴더의 파일을 보여주는 형식 입니다.
제가 사용하게 된지가 오래 되어서 출처는 잘 모르겠습니다.
조금 불편하고 개선할 부분이 있어서 혹시 관심이 있는 분이 있으시면..
수정 부탁 드립니다.
-수정할 사항-
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("."); //시작할 폴더위치를 지정한다.
게시판 목록
프로그램
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 1630 | 18년 전 | 2372 | ||
| 1629 | 18년 전 | 2838 | ||
| 1628 |
인스웨이브시스템즈
|
18년 전 | 4615 | |
| 1627 | 18년 전 | 2679 | ||
| 1626 |
silence
|
18년 전 | 1876 | |
| 1625 |
|
18년 전 | 3320 | |
| 1624 | 18년 전 | 3139 | ||
| 1623 | 18년 전 | 3863 | ||
| 1622 | 18년 전 | 2173 | ||
| 1621 | 18년 전 | 2355 | ||
| 1620 | 18년 전 | 10015 | ||
| 1619 | 18년 전 | 3505 | ||
| 1618 | 18년 전 | 3309 | ||
| 1617 | 18년 전 | 3190 | ||
| 1616 |
|
18년 전 | 2804 | |
| 1615 | 18년 전 | 4165 | ||
| 1614 |
에스카르고
|
18년 전 | 5507 | |
| 1613 | 18년 전 | 3742 | ||
| 1612 | 18년 전 | 3191 | ||
| 1611 | 18년 전 | 3609 | ||
| 1610 |
DHenny
|
18년 전 | 2264 | |
| 1609 | 18년 전 | 2691 | ||
| 1608 |
|
18년 전 | 3922 | |
| 1607 | 18년 전 | 2849 | ||
| 1606 |
|
18년 전 | 4368 | |
| 1605 | 18년 전 | 2084 | ||
| 1604 |
|
18년 전 | 2525 | |
| 1603 |
|
18년 전 | 2418 | |
| 1602 |
|
18년 전 | 3774 | |
| 1601 |
|
18년 전 | 3839 | |
| 1600 | 18년 전 | 2577 | ||
| 1599 | 18년 전 | 2647 | ||
| 1598 | 18년 전 | 2980 | ||
| 1597 |
|
18년 전 | 2803 | |
| 1596 |
|
18년 전 | 2015 | |
| 1595 |
|
18년 전 | 2183 | |
| 1594 | 18년 전 | 4835 | ||
| 1593 | 18년 전 | 4179 | ||
| 1592 | 18년 전 | 2804 | ||
| 1591 | 18년 전 | 2361 | ||
| 1590 | 18년 전 | 2872 | ||
| 1589 | 18년 전 | 2343 | ||
| 1588 |
|
18년 전 | 3504 | |
| 1587 | 18년 전 | 2172 | ||
| 1586 | 18년 전 | 1969 | ||
| 1585 | 18년 전 | 1823 | ||
| 1584 | 18년 전 | 1643 | ||
| 1583 | 18년 전 | 3242 | ||
| 1582 | 18년 전 | 4560 | ||
| 1581 | 18년 전 | 4841 | ||
| 1580 |
|
18년 전 | 2131 | |
| 1579 | 18년 전 | 3581 | ||
| 1578 | 18년 전 | 3305 | ||
| 1577 | 18년 전 | 4598 | ||
| 1576 | 18년 전 | 3239 | ||
| 1575 | 18년 전 | 4240 | ||
| 1574 |
개발전문가
|
18년 전 | 3925 | |
| 1573 |
mixdesign
|
18년 전 | 3623 | |
| 1572 |
mixdesign
|
18년 전 | 3017 | |
| 1571 |
mixdesign
|
18년 전 | 2908 | |
| 1570 | 18년 전 | 3482 | ||
| 1569 |
mixdesign
|
18년 전 | 2137 | |
| 1568 |
mixdesign
|
18년 전 | 2099 | |
| 1567 | 18년 전 | 5503 | ||
| 1566 |
mixdesign
|
18년 전 | 2677 | |
| 1565 |
mixdesign
|
18년 전 | 2431 | |
| 1564 | 18년 전 | 2738 | ||
| 1563 | 18년 전 | 2074 | ||
| 1562 | 18년 전 | 3069 | ||
| 1561 | 18년 전 | 10029 | ||
| 1560 |
행복속네잎크로버
|
18년 전 | 1922 | |
| 1559 | 18년 전 | 2834 | ||
| 1558 |
1111111
|
18년 전 | 2873 | |
| 1557 |
1111111
|
18년 전 | 2128 | |
| 1556 |
1111111
|
18년 전 | 2970 | |
| 1555 |
1111111
|
18년 전 | 3975 | |
| 1554 |
1111111
|
18년 전 | 2923 | |
| 1553 |
1111111
|
18년 전 | 2297 | |
| 1552 |
1111111
|
18년 전 | 6016 | |
| 1551 |
1111111
|
18년 전 | 3646 | |
| 1550 |
1111111
|
18년 전 | 6313 | |
| 1549 |
1111111
|
18년 전 | 2411 | |
| 1548 |
1111111
|
18년 전 | 2339 | |
| 1547 |
1111111
|
18년 전 | 2372 | |
| 1546 |
1111111
|
18년 전 | 3315 | |
| 1545 |
1111111
|
18년 전 | 3169 | |
| 1544 |
1111111
|
18년 전 | 1955 | |
| 1543 |
1111111
|
18년 전 | 3687 | |
| 1542 |
1111111
|
18년 전 | 1606 | |
| 1541 |
1111111
|
18년 전 | 1348 | |
| 1540 |
1111111
|
18년 전 | 1369 | |
| 1539 |
1111111
|
18년 전 | 1527 | |
| 1538 |
1111111
|
18년 전 | 1621 | |
| 1537 |
스카이부아
|
18년 전 | 3415 | |
| 1536 |
1111111
|
18년 전 | 2248 | |
| 1535 |
1111111
|
18년 전 | 1707 | |
| 1534 |
1111111
|
18년 전 | 2095 | |
| 1533 |
1111111
|
18년 전 | 4594 | |
| 1532 |
1111111
|
18년 전 | 2329 | |
| 1531 |
1111111
|
18년 전 | 2979 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기