PHP Applications
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me



Go Back   Codewalkers ForumsPHP RelatedPHP Applications

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Old September 9th, 2012, 03:51 PM
lse123 lse123 is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 164 lse123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 h 17 m 39 sec
Reputation Power: 6
How get all image names of files in image folder in php5

How get all image names of files in image folder in php5? after will use php to eject html to view all images in a web page...

Reply With Quote
Old September 22nd, 2012, 05:38 AM
vaayaaedu vaayaaedu is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Sep 2012
Posts: 6 vaayaaedu User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 31 m 4 sec
Reputation Power: 0
Send a message via Google Talk to vaayaaedu
$image_file_path = '/home/user/www/path/'; - this is the full server path to your images folder

$d = dir($image_file_path) or die("Wrong path: $image_file_path");
while (false !== ($entry = $d->read())) {
if($entry != '.' && $entry != '..' && !is_dir($dir.$entry))
$Images[] = $entry;
}
$d->close();

It creates an array $Images with all filenames

Reply With Quote
Old September 25th, 2012, 12:33 PM
IAmALlama IAmALlama is offline
Me
Click here for more information
 
Join Date: Apr 2007
Location: San Diego, CA
Posts: 2,267 IAmALlama User rank is Lance Corporal (50 - 100 Reputation Level)IAmALlama User rank is Lance Corporal (50 - 100 Reputation Level)IAmALlama User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 6 h 30 m 38 sec
Reputation Power: 9
even easier:

PHP Code:
 $images glob("/path/to/images/{*.png,*.gif,*.jpg}"GLOB_BRACE); 

Reply With Quote
Old September 27th, 2012, 01:22 PM
lse123 lse123 is offline
Contributing User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 164 lse123 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 23 h 17 m 39 sec
Reputation Power: 6
how make Global var not only in while?

$Images[] // how make Global var not only in while?

glob command found in PHP/MySQL shared hosting environments?

Reply With Quote
Old September 28th, 2012, 12:13 PM
IAmALlama IAmALlama is offline
Me
Click here for more information
 
Join Date: Apr 2007
Location: San Diego, CA
Posts: 2,267 IAmALlama User rank is Lance Corporal (50 - 100 Reputation Level)IAmALlama User rank is Lance Corporal (50 - 100 Reputation Level)IAmALlama User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 2 Weeks 1 Day 6 h 30 m 38 sec
Reputation Power: 9
the glob command not found would depend on your host. If they are using a VERY old version of php (glob was introduced in php 4.3.0). If they disabled the function in the php.ini file. Glob isn't available on some OS such as old versions of sun os.

Most likely, if you can't run the function, they have the function disabled in php.ini. I gave up shared hosting long ago for reasons like this.

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Applications > How get all image names of files in image folder in php5


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap