Re: Script to Fetch Elephpants
| From: | Hannes Magnusson | Date: | Thu, 15 Sep 2011 06:57:58 +0000 |
| Subject: | Re: Script to Fetch Elephpants | ||
| References: | 1 | Groups: | php.webmaster |
| Request: | Send a blank email to php-webmaster+get-12190@lists.php.net to get a copy of this message | ||
On Thu, Sep 15, 2011 at 07:10, Stewart Lord <stewey@ambitious.ca> wrote:
> Hi Hannes,
>
> I've written a script to pull elephpants from Flickr. It is designed to sit beside
> pregen_news (under the php-master scripts folder). You can view the script here:
>
> http://pastebin.com/rk8LmByV
>
> To use it:
>
> include 'pregen_flickr';
> pregen_flickr(
> 'your-api-key',
> '/path/to/write/images/to',
> 10
> );
>
> If you could review this script for suitability for inclusion with the other backend scripts,
> that would be great!
>
Is url_sq guaranteed never to contain urlencoded paths, or
non-windows-friendly-filenames?
I doubt we have any Windows mirrors though.. but who knows.
I notice you never cleanup the fetched images, so we will quickly have
bucketload of images.. maybe thats the idea - then we can shuffle them
on the mirrors?
Its also missing sanitychecks around the file_get_contents() for the
json data, and ensuring $decoded actually contains anything before
overwriting photos.json.
Same when fetching the file, it needs to verify it actually fetched something.
..And maybe check if the file already exists before overwriting it?
-Hannes