%PDF- %PDF-
Direktori : /home/dordingu/public_html/munnridur/photo/ |
Current File : /home/dordingu/public_html/munnridur/photo/func.php |
<?php /****************************************************** TECAImage -- A TECAZONE Product Copyright (c) 2003 TECAZONE (tech@tecazone.com) *******************************************************/ function showImg($aPath, $aFn, $aThisPage) { global $g_twidth, $g_dispFn; $fullpath = $aPath.$aFn; // find the width and height of the thumbnail $imgsize = GetImageSize($fullpath); $twidth = $g_twidth; $theight = $imgsize[1] / ($imgsize[0]/$twidth); // generate the html echo "<td valign=top height=130>"; echo "<center><a href=\"$PHP_SELF?path=$aPath&page=$aThisPage&img=$aFn\"><img border=\"0\" width=\"$twidth\" height=\"$theight\" src=\"genthumbs.php?image=$fullpath&w=$twidth\"></img></a></center>"; if($g_dispFn) { $l = strlen($aFn) - 4; // echo "<font size=1><br><center>".substr($aFn, 0, $l)."</center></font>"; } echo "</td>"; } function showBigImg($aPath, $aFn) { echo "<center>"; echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\">"; // generate the html echo "<td>"; echo "<center><img border=\"0\" src=\"".$aPath.$aFn."\"></img></center>"; echo "</td>"; echo "</table>"; echo "</center>"; } function showDir($aPath, $aFn) { $fullpath = $aPath.$aFn; $imgsize = GetImageSize("folder.gif"); echo "<td>"; echo "<center><a href=\"$PHP_SELF?path=$fullpath/\"><img border=\"0\" width=\"$imgsize[0]\" height=\"$imgsize[1]\" src=\"folder.gif\"></img></a></center>"; echo "<br><center>$aFn</center>"; echo "</td>"; } function showImgRow($aPath, $aFiles, $aIsDir, $aThisPage, $aStart, $aEnd) { echo "<tr>"; for($i=$aStart; $i<$aEnd; $i++) { if($aIsDir[$i]) { showDir($aPath, $aFiles[$i]); } else { showImg($aPath, $aFiles[$i], $aThisPage); } } echo "</tr>"; } function showImgTable($aPath, $aFiles, $aIsDir, $aThisPage, $aNumCols, $aNumRows) { $numPerPage = $aNumRows * $aNumCols; $totalFiles = count($aFiles); $start = $aThisPage * $numPerPage; $end = $start + $numPerPage; $end = min($end, $totalFiles); echo "<center>"; echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\">"; while($start < $end) { $e = min($start + $aNumCols, $end); showImgRow($aPath, $aFiles, $aIsDir, $aThisPage, $start, $e); $start += $aNumCols; } echo "</table>"; echo "</center>"; } function showPageLinks($aPath, $aNumFiles, $aThisPage, $aImg, $aNumCols, $aNumRows) { $numPerPage = $aNumCols * $aNumRows; $numPages = ceil($aNumFiles / $numPerPage); /* * reverse finding '/' start from the second last char * since the last char must be '/' */ $pdir = ""; $plen = strlen($aPath); for($j=$plen-2; $j>0; $j--) { if($aPath[$j] == '/') { $pdir = substr($aPath, 0, $j+1); break; } } echo "<br><center>"; echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\">"; echo "<tr>"; if($aImg) { // Showing big image echo "<td><a href=\"$PHP_SELF?path=$aPath&page=$aThisPage\"> Til baka </a></td>"; } else { // show the up link if($pdir != "") { echo "<td><a href=\"$PHP_SELF?path=$pdir\">Upp</a></td>"; } // show the page links if($numPages == 0) { echo "<td>Engin mynd � �essarri m�ppu</td>"; } else { // show only 10 pages $minp = 0; $maxp = 10; if($numPages > 10) { $minp = floor($aThisPage/10) * 10; $maxp = ceil(($aThisPage+1)/10) * 10; } $maxp = min($maxp, $numPages); echo "<td></td>"; // show the prev link if($minp >= 10) { $prevp = $minp - 1; echo "<td><a href=\"$PHP_SELF?path=$aPath&page=$prevp\"><</a></td>"; } // show page no(s) for($i=$minp; $i<$maxp; $i++) { $p = $i + 1; if($aThisPage == $i) { // echo "<td><b>$p</b></td>"; } else { // echo "<td><a href=\"$PHP_SELF?path=$aPath&page=$i\">$p</a></td>"; } } // show the next link if($maxp < $numPages) { $nextp = $maxp; echo "<td><a href=\"$PHP_SELF?path=$aPath&page=$nextp\">></a></td>"; } } } echo "</tr>"; echo "</table>"; echo "</center>"; } function showFooter() { echo "<center><font size=\"-2\"><a target=\"_blank\" href=\"http://www.tecazone.com/products/tecaimage/\">TECAImage</a>, a <a target=\"_blank\" href=\"http://www.tecazone.com\">TECAZONE</a> product</font></center>"; } function readFiles($aPath) { global $files, $isDir; global $g_sort_by_filename; $files = array(); $isDir = array(); $confdir = "imgconfig"; $dir_handle = @opendir($aPath) or die("Unable to open $aPath"); while($file = readdir($dir_handle)) { $fullpath = $aPath.$file; if(is_dir($fullpath)) { if($file != '.' && $file != '..' && $file != $confdir) { $files[] = $file; $isDir[] = true; } } else { $ext = substr($file, -4); //if($file[0] != '.' && ($ext == '.jpg' || $ext == '.gif')) { if($file[0] != '.' && (strtolower($ext) == '.jpg')) { $files[] = $file; $isDir[] = false; } } if($g_sort_by_filename) { sort($files); } } closedir($dir_handle); } function adjustPath($aPath) { $ret = $aPath; if(!$ret) $ret = "./"; if(substr($ret, -1) != "/") $ret = $ret.'/'; // reset to home, if illegal access if(substr($ret, 0, 1) != '.' || strstr($ret, "..")) { $ret= './'; } return $ret; } ?>