Current location: Hot Scripts Forums » Programming Languages » PHP » show images from folder


show images from folder

Reply
  #1 (permalink)  
Old 06-21-05, 02:59 PM
kalinchuk kalinchuk is offline
Wannabe Coder
 
Join Date: Jun 2004
Location: ...
Posts: 110
Thanks: 0
Thanked 0 Times in 0 Posts
show images from folder

how can i show all the images in a folder?
Reply With Quote
  #2 (permalink)  
Old 06-21-05, 03:26 PM
dennispopel dennispopel is offline
Coding Addict
 
Join Date: Mar 2005
Posts: 263
Thanks: 0
Thanked 0 Times in 0 Posts
Hello,

Assuming you store your images in $imgRealPath, just glob() the directory and generate <img> tags to them:

foreach(glob("$imgRealPath/{*.jpg,*.png,*.gif}", GLOB_BRACE) as $fname) {
echo "<img src=\"" . $imgWebPath . "/" . baseName($fname) . "\" alt=\"$fname\" />";
}

where $imgWebpath is the web-accessible directory of the images folder.
__________________
onPHP5.com - PHP5: Articles, News, Tutorials, Interviews, Software and more
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
images dont display, not wrong path eq1987 HTML/XHTML/XML 2 11-29-04 03:42 AM
Cached images drivingme nuts Mikeirv ASP 0 08-16-04 11:58 AM
Need help on a image slide show using php! xelanoimis PHP 2 10-16-03 06:51 PM
List images and zip before download jaimexyz Script Requests 0 09-01-03 03:01 PM
edit php in Squirrelmail jrcortrightiii PHP 1 07-10-03 02:08 PM


All times are GMT -5. The time now is 06:50 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.