techker Posted May 8, 2006 Share Posted May 8, 2006 hey guys i have been looking for something for a long time now.with my server it is configed so we can view the content of a folder.now i wold like to view it but in thumb nails.im building a ringtone site and i have wallpapers that i want to put ,but i don't want to start making thumb nails of each and putting them on a page...lasyso i want to make so i could direct a page to the folder directly,and i would see the images directly...now i have been googling it and nothing to be seen!can somebosy help me please... Link to comment https://forums.phpfreaks.com/topic/9324-folder-content/ Share on other sites More sharing options...
alpine Posted May 8, 2006 Share Posted May 8, 2006 One very basic example - look it up in the [a href=\"http://www.php.net\" target=\"_blank\"]Manual[/a],put this in a file in the folder with your images - and call the file[code] if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "<img src='". $file."'>";} }closedir($handle); }[/code] Link to comment https://forums.phpfreaks.com/topic/9324-folder-content/#findComment-34379 Share on other sites More sharing options...
techker Posted May 8, 2006 Author Share Posted May 8, 2006 [!--quoteo(post=372365:date=May 8 2006, 06:53 PM:name=alpine)--][div class=\'quotetop\']QUOTE(alpine @ May 8 2006, 06:53 PM) [snapback]372365[/snapback][/div][div class=\'quotemain\'][!--quotec--]One very basic example - look it up in the [a href=\"http://www.php.net\" target=\"_blank\"]Manual[/a],put this in a file in the folder with your images - and call the file[code] if ($handle = opendir('.')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { echo "<img src='". $file."'>";} }closedir($handle); }[/code][/quote]it gives me errors?and here is a stupid question,do i put it in the body or before the head?lolbut it gives me thisParse error: syntax error, unexpected '{' in /home2/techker/public_html/wallpapers_bb/view.php on line 5 Link to comment https://forums.phpfreaks.com/topic/9324-folder-content/#findComment-34385 Share on other sites More sharing options...
alpine Posted May 8, 2006 Share Posted May 8, 2006 Like this:[code]<head></head><body>Headline info or whatever goes here<?phpif ($handle = opendir('.')){while (false !== ($file = readdir($handle))){if ($file != "." && $file != ".."){echo "<img src='".$file."'>";}}closedir($handle);}?>Footer or whatever goes here</body>[/code]your parse error must be a cut'n paste error or something... Link to comment https://forums.phpfreaks.com/topic/9324-folder-content/#findComment-34435 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.