Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/68125-listing-all-images-from-a-site/
Share on other sites

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.