skeetley Posted November 15, 2006 Share Posted November 15, 2006 I am looking for a very simple script to auto retrieve the images from a dir and show them. I don't care if the file needs to be placed in that dir or any other dir. I don't care about formatting the output. I just want a resulting page that I can go to and quickly scroll through my images.I have checked the google and all I can find are scripts for actual image galleries. I don't want to put that much work into this. The ones that I thought should work, I couldn't get to work.I used the search here. The only similar question I found went unanswered.Perhaps I am searching for the wrong terms. Anyone know what I should search for? Or know of such a script?Many thanks. Quote Link to comment Share on other sites More sharing options...
doni49 Posted November 15, 2006 Share Posted November 15, 2006 Have a look here. www.php.net/diruse the dir function to return a list of files in the folder.then once you have your list you can lloop through the list and write your image tags:foreach($files as $file){ echo '<img src="' . $file . '">';} Quote Link to comment Share on other sites More sharing options...
jsladek Posted November 15, 2006 Share Posted November 15, 2006 Just wrote this real quick[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Untitled Document</title></head><body><center> <?foreach (glob("images/*.*") as $filename){ print("<a href=\"$filename\">$filename<br><img src=\"$filename\"></a><hr>");}?></center></body></html>[/code]Regards,John Sladekcan someone tell me how to put code in the post highliged as PHP. I'm using the [ c o d e] tags Quote Link to comment Share on other sites More sharing options...
skeetley Posted November 15, 2006 Author Share Posted November 15, 2006 Thank you both! Your script works and is exactly what I need John. Quote Link to comment Share on other sites More sharing options...
SharkBait Posted November 15, 2006 Share Posted November 15, 2006 [quote author=jsladek link=topic=115024.msg468199#msg468199 date=1163557993]Just wrote this real quick[code]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN""http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Untitled Document</title></head><body><center> <?foreach (glob("images/*.*") as $filename){ print("<a href=\"$filename\">$filename<br><img src=\"$filename\"></a><hr>");}?></center></body></html>[/code]Regards,John Sladekcan someone tell me how to put code in the post highliged as PHP. I'm using the [ c o d e] tags[/quote]Just use <?php and ?> inside your [ co de] tags :) Quote Link to comment 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.