AbydosGater Posted September 5, 2007 Share Posted September 5, 2007 Hey guys, I have an extensive site running on my local. Images are all over the place. I know its possible to use a PEAR Module to get all the links from a html page.. But i was wondering if it was possible to save all <img src"VALUES"> all the links (Values) to an array so that i can then write a script to copy the file to the images folder? Andy Quote Link to comment https://forums.phpfreaks.com/topic/68125-listing-all-images-from-a-site/ Share on other sites More sharing options...
The Little Guy Posted September 5, 2007 Share Posted September 5, 2007 http://php.net/glob Quote Link to comment https://forums.phpfreaks.com/topic/68125-listing-all-images-from-a-site/#findComment-342474 Share on other sites More sharing options...
cooldude832 Posted September 5, 2007 Share Posted September 5, 2007 I'd just like to expand on the post about glob. Glob is what you are seeking, but basically you need to do (I don't think a function can do it for you that is pre-built) that gets each subfolder's content, sorta like start at root and get each folder than then say foreach folder find each folder in it, then say foreach folder in that find each folder, then in each folder of that and so forth till subfolders aren't found. Then in each folder use the glob function to find files, read them, find img tags, and then store them in a sorta multideminosnal array $files['Location'] [] = "that files location"; $files["src"][] = "The source of that image"; You will probably want to create a function that recals itself to read each subfolder level, only hard part i see is keeping track of the location. Quote Link to comment https://forums.phpfreaks.com/topic/68125-listing-all-images-from-a-site/#findComment-342482 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.