nisroc Posted October 2, 2009 Share Posted October 2, 2009 What i am trying to do is create a gallery by using the paths to a folder as links, example is <a href="../gallery/scenes"> ... and ../gallery/cities.... I have a sidebar menu populated like this and works fast so i wish to keep it. Now in my main content area i have a php script that will read the directory contents and display the images in the folder into a div. I have two questions; <?php $path = "gallery/scenes"; $dh = opendir($path); while (false !== ($file = readdir($dh))) { if ($file != "." && $file != "..") { echo "<img src=\"$path/$file\" height=\"100\" width=\"100\" />"; } } closedir ($dh); ?> First is, folders are generating thumbs.db file when the images are called to the page. it has not affected me that i can see but i would like to cancel it out from the script anyway. To do so i wish to filter the db extension, but i do not know how, A little shove/push in right direction should help me here. Second Like i said in fist paragraph, i want to have a links that that point to a directory and that when clicked will trigger the script above. My problem is how would i trigger this script from a link? I really do not wish to create whole new page for each gallery. Thanks in advance for any help on these problems Quote Link to comment https://forums.phpfreaks.com/topic/176252-file-extension-and-trigger/ Share on other sites More sharing options...
RussellReal Posted October 2, 2009 Share Posted October 2, 2009 for 'first' change if ($file != "." && $file != "..") { echo "<img src=\"$path/$file\" height=\"100\" width=\"100\" />"; } to if (($file != ".") && ($file != "..") && (substr($file,strlen($file) - 3) != '.db')) { echo "<img src=\"$path/$file\" height=\"100\" width=\"100\" />"; } for 'second' you'd want htaccess Quote Link to comment https://forums.phpfreaks.com/topic/176252-file-extension-and-trigger/#findComment-928861 Share on other sites More sharing options...
nisroc Posted October 2, 2009 Author Share Posted October 2, 2009 That helped big time. I though browser was running slow cause of the image size now that i added that small part you suggested it is running normal again. ty Quote Link to comment https://forums.phpfreaks.com/topic/176252-file-extension-and-trigger/#findComment-928877 Share on other sites More sharing options...
RussellReal Posted October 2, 2009 Share Posted October 2, 2009 no problemo Quote Link to comment https://forums.phpfreaks.com/topic/176252-file-extension-and-trigger/#findComment-928881 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.