Jump to content

javivilchis

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

javivilchis's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I guess this line of code fixed it. <?php $path = (isset($path)) ? $path : ''; $path = adjustPath($path); if(!$page) $page = 0; if(!$g_cols) $g_cols = 4; if(!$g_rows) $g_rows = 1; if(!$g_title) $g_title = "Image Gallery"; if(!$g_twidth) $g_twidth = 100; $files = array(); $isDir = array("." => false); @readFiles($path, $files, $isDir); thanks for your help.
  2. i'm doing the error tracking lines that go to the very top of the <? code, if that does not show me I will try the $GET. However, i'm having the IT person upload these files to the server because I don't have permissions for the server. bear with me. thanks
  3. sorry fly for not placing the whole script, but I am declaring the path in a func.php file whic I called in on line: 141 <?php // in case register global is off foreach($HTTP_GET_VARS as $key => $val) { $$key = $val; global $$key; } global $files, $isDir, $g_twidth, $g_cols, $g_rows, $g_title, $g_desc, $g_dispFn, $g_sortByFn, $g_folderImg, $g_showInPopup, $g_popupWidth, $g_popupHeight; include("func.php"); $path = adjustPath($path); if(!$page) $page = 0; if(!$g_cols) $g_cols = 4; if(!$g_rows) $g_rows = 1; if(!$g_title) $g_title = "Image Gallery"; if(!$g_twidth) $g_twidth = 100; $files = array(); $isDir = array("." => false); @readFiles($path, $files, $isDir); ?> func.php file <? function showImg($aPath, $aFn, $aIdx, $aThisPage, $aSubDir="") { global $g_twidth, $g_dispFn, $g_thumb_worh, $g_showInPopup, $g_popupWidth, $g_popupHeight, $g_shrinkPopup; $fullpath = $aPath.$aFn; // find the width and height of the thumbnail $imgsize = GetImageSize($fullpath); if($g_thumb_worh == 'w') { $twidth = $g_twidth; $theight = $imgsize[1] / ($imgsize[0]/$twidth); } else { $theight = $g_twidth; $twidth = $imgsize[0] / ($imgsize[1]/$theight); } // generate the html echo "<td>"; if($aSubDir != "") { echo "<center><a href=\"$PHP_SELF?path=$aPath\"><img border=\"0\" width=\"$twidth\" height=\"$theight\" src=\"genthumbs.php?image=$fullpath&w=$twidth\"></img></a></center>"; } else { // need scrollbar? $sb = "yes"; if($g_showInPopup == 'check') { $w = $g_popupWidth; $h = $g_popupHeight; if($g_shrinkPopup == 'check') { $picsize = GetImageSize($aPath.$aFn); if($picsize[0]+10 < $w && $picsize[1]+10 < $h) { $w = $picsize[0]+10; $h = $picsize[1]+10; $sb = "no"; } } echo "<center><a href=# onclick=\"javascript:window.open('$aPath$aFn', '_blank', 'width=$w, height=$h, scrollbars=$sb');return false\"><img border=\"0\" width=\"$twidth\" height=\"$theight\" src=\"genthumbs.php?image=$fullpath&w=$twidth\"></img></a></center>"; } else echo "<center><a href=\"$PHP_SELF?path=$aPath&page=$aThisPage&img=$aFn&idx=$aIdx\"><img border=\"0\" width=\"$twidth\" height=\"$theight\" src=\"genthumbs.php?image=$fullpath&w=$twidth\"></img></a></center>"; } // display filename? if($g_dispFn) { echo "<br><center>"; if($aSubDir == "") { $l = strlen($aFn) - 4; echo substr($aFn, 0, $l); } else { echo $aSubDir."[dir]"; } echo "</center>"; } echo "</td>"; } /* * show the image in real size */ function showBigImg($aPath, $aIdx) { global $files, $isDir; echo "<center>"; echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\">"; if($isDir[$files[$aIdx]]) { showDir($aPath, $files[$aIdx]); } else { // generate the html echo "<td>"; echo "<center><img border=\"0\" src=\"".$aPath.$files[$aIdx]."\"></img></center>"; echo "</td>"; echo "</table>"; echo "</center>"; } } /* * get the filename of the first image from a folder */ function getFirstImgFn($aPath, $aExt) { $dir_handle = @opendir($aPath) or die("Unable to open $aPath"); while($file = readdir($dir_handle)) { $fullpath = $aPath.$file; if(is_dir($fullpath) == false) { $ext = substr($file, -4); if(strtolower($ext) == $aExt) { return $file; } } } /* * return empty if no img exists. */ return ""; } /* * get the filename of a random image from a folder */ function getRandomImgFn($aPath, $aExt) { $dir_handle = @opendir($aPath) or die("Unable to open $aPath"); $imgfiles = array(); while($file = readdir($dir_handle)) { $fullpath = $aPath.$file; if(is_dir($fullpath) == false) { $ext = substr($file, -4); if(strtolower($ext) == $aExt) { $imgfiles[] = $file; } } } $num = count($imgfiles); if($num <= 0) { /* * return empty if no img exists. */ return ""; } /* * randomly pick one */ $idx = rand(0, $num-1); return $imgfiles[$idx]; } /* * show the thumb / image of a folder */ function showDir($aPath, $aFn) { global $g_showFirstThumb, $g_folderImg; $fullpath = $aPath.$aFn."/"; // 3 --> first jpg image, 4 --> random jpg image if($g_folderImg == '3' || $g_folderImg == '4') { $fn = ""; if($g_folderImg == '3') $fn = getFirstImgFn($fullpath, '.jpg'); else $fn = getRandomImgFn($fullpath, '.jpg'); if($fn != "") { showImg($fullpath, $fn, "0", "0", $aFn); return; } } echo "<td>"; $done = false; // 2 --> first gif image if($g_folderImg == '2') { $fn = getFirstImgFn($fullpath, '.gif'); if($fn != "") { $imgsize = GetImageSize($fullpath.$fn); echo "<center><a href=\"$PHP_SELF?path=$fullpath\"><img border=\"0\" width=\"$imgsize[0]\" height=\"$imgsize[1]\" src=\"$fullpath$fn\"></img></a></center>"; $done = true; } } // default is folder.gif if($done == false) { $imgsize = GetImageSize("folder.gif"); 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>"; } /* * show 1 row of thumbs */ function showImgRow($aPath, $aFiles, $aIsDir, $aThisPage, $aStart, $aEnd) { echo "<tr>"; for($i=$aStart; $i<$aEnd; $i++) { if($aIsDir["_".$aFiles[$i]]) { showDir($aPath, $aFiles[$i]); } else { showImg($aPath, $aFiles[$i], $i, $aThisPage); } } echo "</tr>"; } /* * show the whole table of thumbs */ function showImgTable($aPath, $aFiles, $aIsDir, $aThisPage, $aNumCols, $aNumRows) { global $g_spacing; $numPerPage = $aNumRows * $aNumCols; $totalFiles = count($aFiles); $start = $aThisPage * $numPerPage; $end = $start + $numPerPage; $end = min($end, $totalFiles); echo "<center>"; echo "<table border=\"0\" cellspacing=\"$g_spacing\" cellpadding=\"0\">"; while($start < $end) { $e = min($start + $aNumCols, $end); showImgRow($aPath, $aFiles, $aIsDir, $aThisPage, $start, $e); $start += $aNumCols; } echo "</table>"; echo "</center>"; } /* * show the links to different pages */ function showPageLinks($aPath, $aNumFiles, $aThisPage, $aIdx, $aNumCols, $aNumRows) { global $files; $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($aIdx != "") { // Showing back link echo "<td><a href=\"$PHP_SELF?path=$aPath&page=$aThisPage\">Back To Thumbs</a></td>"; // show prev, next link if($aIdx > 0) { $idx = $aIdx - 1; echo "<td><a href=\"$PHP_SELF?path=$aPath&page=$aThisPage&idx=$idx\"><</a></td>"; } if($aIdx + 1 < count($files)) { $idx = $aIdx + 1; echo "<td><a href=\"$PHP_SELF?path=$aPath&page=$aThisPage&idx=$idx\">></a></td>"; } } else { // show the up link if($pdir != "") { echo "<td><a href=\"$PHP_SELF?path=$pdir\">UP</a></td>"; } // show the page links if($numPages == 0) { echo "<td>No image in this folder</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>page:</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.flash-here.com/downloads/fhimage.html\">FhImage</a>, powered by <a target=\"_blank\" href=\"http://www.flash-here.com\">Flash-here.com</a></font></center>"; } // case insensitive comparison function cicmp($a, $b) { return strcasecmp($a, $b); } /* * read file / dir names from a directory */ function readFiles($aPath, &$aFiles, &$aIsDir) { global $g_sortByFn, $g_insensitive_sort; $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) { $aFiles[] = $file; $tmparray = array("_".$file => true); $aIsDir = array_merge($aIsDir, $tmparray); } } else { $ext = substr($file, -4); if($file[0] != '.' && (strtolower($ext) == '.jpg')) { $aFiles[] = $file; $tmparray = array("_".$file => false); $aIsDir = array_merge($aIsDir, $tmparray); } } if($g_sortByFn == 'check') { if($g_insensitive_sort == 'check') { usort($aFiles, "cicmp"); } else { sort($aFiles); } } } 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; } ?>
  4. Hello all, I need help with merging php 4 to 5, i'm getting the following errors but I don't see and don't know if is the syntax that is wrong or if there is a new way of calling the variables, Please help. Notice: Undefined variable: path in F:\hyacinthvases\imagegallery2\index.php on line 143 the code below starts on line 143 $path = adjustPath($path); if(!$page) $page = 0; if(!$g_cols) $g_cols = 4; if(!$g_rows) $g_rows = 1; if(!$g_title) $g_title = "Image Gallery"; if(!$g_twidth) $g_twidth = 100; $files = array(); $isDir = array("." => false); @readFiles($path, $files, $isDir); Notice: Undefined variable: page in F:\hyacinthvases\imagegallery2\index.php on line 144
  5. o.k.. it was definitely the javascript that caused this not to work, everything else works just fine. I will upgrade the code to php 5 standards. Thanks to gevans for the javascript it worked like a charm. thank you all again, jav
  6. Gevans, i've changed it to <script type="text/javascript"> still nothing.
  7. <head> <script language="JavaScript"> function noway(go) { if (document.all) { if (event.button == 2) { alert(popup); return false; } } if (document.layers) { if (go.which == 3) { alert(popup); return false; } } } if (document.layers) { document.captureEvents(Event.MOUSEDOWN); } document.onmousedown=noway; </script> <script language="JavaScript1.1"> // distributed by http://www,hypergurl.com var debug = true; function right(e) { if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false; else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) { alert('This Page is fully protected!'); return false; } return true; } document.onmousedown=right; if (document.layers) window.captureEvents(Event.MOUSEDOWN); window.onmousedown=right;</script> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <title>Hyacinth Vase Collection</title> <?php if (is_file("./settings.php")) { include("settings.php"); } if (is_file("./styles.php")) { include("styles.php"); } global $g_bgcolor, $g_titlecolor, $g_desccolor; ?> <style type="text/css"> @charset "UTF-8"; body { font-family: Arial, Helvetica, sans-serif; color:#333333; size: 12px; background-color:#ffffb7; padding:0px; margin:0px; } .mainpage { background-color:#ffffff; padding:5px; vertical-align:top; } .header { background-color:#ffffb7; } .logo { background-color:#ffffb7; padding:10px; font-family:Arial, Helvetica, sans-serif; color:#ffffff; font-size:16px; } #header { float:left; width:100%; background-color:#ffffb7; line-height:normal; } #header ul { margin:0; padding:0px 0px 0; list-style:none; } #header li { float:left; background-color:#ffffb7; margin:0; padding:0 0 0 53px; } #header a { float:left; display:block; background-color:#ffffb7; background-image:URL(..images/buttonback.png); padding:11px 40px 11px 0px; text-decoration:none; font-weight:bold; color:#333333; } /* Commented Backslash Hack hides rule from IE5-Mac \*/ #header a {float:none;} /* End IE5-Mac hack */ #header a:hover { color:#000000; } #header #current { background-image:url("left_on.gif"); } #header #current a { background-color:#ffe600; padding-left:14px; color:#ffffff; } </style> </head> <?php // in case register global is off foreach($HTTP_GET_VARS as $key => $val) { $$key = $val; global $$key; } global $files, $isDir, $g_twidth, $g_cols, $g_rows, $g_title, $g_desc, $g_dispFn, $g_sortByFn, $g_folderImg, $g_showInPopup, $g_popupWidth, $g_popupHeight; include("func.php"); $path = adjustPath($path); if(!$page) $page = 0; if(!$g_cols) $g_cols = 4; if(!$g_rows) $g_rows = 1; if(!$g_title) $g_title = "Image Gallery"; if(!$g_twidth) $g_twidth = 100; $files = array(); $isDir = array("." => false); @readFiles($path, $files, $isDir); ?> <html> <body <?php if($g_textcolor != "") echo "text=\"$g_textcolor\" "; if($g_linkcolor != "") echo "link=\"$g_linkcolor\" "; if($g_vlinkcolor != "") echo "vlink=\"$g_vlinkcolor\" "; ?> onload="noway()" ondragstart="return false" onselectstart="return false"> <table width="800" height="768" border="0" align="center" cellpadding="0" cellspacing="0" id="Table_01"> <tr> <td height="88px" class="logo"> <img src="../images/hvclogo.png"> </td> </tr> <tr> <td height="43" class="header"> <div id="header"> <ul> <li><a href="../index.php">Home</a></li> <li><a href="../about.php">About Vase Collection</a></li> <li><a href="../history.php">History</a></li> <li id="current"><a href="../imagegallery2/index.php">Gallery</a></li> <li><a href="contact.php">Contact</a></li> </ul> </div> </td> </tr> <tr> <td width="800px" height="590px" class="mainpage"> <div align="center" class="headline"><?php echo $g_title; ?></div> <div align="center" class="desc"><?php echo $g_desc; ?></div> <p> <div align="center"> <a href="../red/index.php"><img src="../images/red.png" border="0"></a> |<a href="../orange/index.php"><img src="../images/orange.png" border="0"></a> | <a href="../yellow/index.php"><img src="../images/yellow.png" border="0"></a> |<a href="../green/index.php"><img src="../images/green.png" border="0"></a> |<a href="../blue/index.php"><img src="../images/blue.png" border="0"></a> |<a href="../purple/index.php"><img src="../images/purple.png" border="0"></a> | <a href="../white/index.php"><img src="../images/white.png" border="0"></a> | <a href="../clear/index.php"><img src="../images/clear.png" border="0"></a> <?php @showPageLinks($path, count($files), $page, $idx, $g_cols, $g_rows); ?> </div> <?php if ($idx == "") { @showImgTable($path, $files, $isDir, $page, $g_cols, $g_rows); } else { @showBigImg($path, $idx); } ?> </td> </tr> <tr> <td> <img src="../images/bottom.png" width="800" height="27" alt=""></td> </tr> <tr> <td> <p>Number of guests visiting my site : <? include ("counter.php"); ?></p></td> </tr> </table> </body> </html>
  8. FYI, i'm using firefox in a macbook pro. should I test it in windows?
  9. i've added the javascript to the index.php then calling the function onload inside the body tag and it is still no result
  10. Thank you guys, How will I call the function within the php code? to work on the dynamic generated pages?
  11. hello all, I have a function that generates images from the image files inside a folder, everything works fine. However, I will like to add a code that will block the right mouse click or better yet, I will like to deactivate the download picture option to prevent people from stealing the images or copying them. Any suggestions in how to do this? the pages are dynamically created, i've tried using javascript but the dynamic pages do not pick it up. here is the function that generates the images: function showBigImg($aPath, $aIdx) { global $files, $isDir; echo "<center>"; echo "<table border=\"0\" cellspacing=\"10\" cellpadding=\"0\">"; if($isDir[$files[$aIdx]]) { showDir($aPath, $files[$aIdx]); } else { // generate the html echo "<td>"; echo "<center><img border=\"0\" src=\"".$aPath.$files[$aIdx]."\"></img></center>"; echo "</td>"; echo "</table>"; echo "</center>"; } }
  12. thank you for responding.. this is the function I have to create pages of my categories: function Paging($page, $totalcount, $perpage, $start){ $eu = ($start - 0); $this1 = $eu + $perpage; $back = $eu - $perpage; $next = $eu + $perpage; $paging =''; $showeachside = 10; $eitherside = ($showeachside * $perpage); if($start+1 > $eitherside)$paging .="<a href='".$page."'>[First]</a> .... "; $y =0; $pg=1; for($y=0;$y<$totalcount;$y+=$perpage) { $class=($y==$start)?"pageselected":""; if(($y > ($start - $eitherside)) && ($y < ($start + $eitherside))) { if($y <> $eu){ $paging .= '<a href="'.$page.'&start='.$y.'" class="'.$class.'" ><span class="paging">'.$pg.'</span></a>'; } else{ $paging .= '<b>'.$pg.'</b>'; } } $pg++; } if(($start+$eitherside)<$totalcount)$paging .=" .... "; if($this1 < $totalcount) { $paging .= "<a href='".$page."&start=$next'>Next</a>";} if($back >=0) { $paging .= "<a href='".$page."&start=$back'>Prev</a>"; } $this->ws_page = $eu; $this->ws_paging = $paging; } } how do I incorporate this to my gallery.php where I use switch case.?
  13. is there anyone that can help. Please :( :(
  14. this is the section that throws the error when I place the function to the gallery.php case "viewpic": include("include/session.php"); include ("header.php"); $t->readFileIntoString(TEMPLATE.'view.tpl',$wspage); $t->setTemplateString($wspage); global $database; $p = new wsCore; $p->GetCatsList(); if(count($p->getcatslist)>0){ foreach($p->getcatslist as $cval){ $listc .= '<a href="?cid='.$cval['c_id'].'">'.$cval['c_name'].'</a> | '; } }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.