Skip to content

Instantly share code, notes, and snippets.

@dmdeller
Created August 1, 2009 18:19
Show Gist options
  • Save dmdeller/159766 to your computer and use it in GitHub Desktop.
Save dmdeller/159766 to your computer and use it in GitHub Desktop.
<?php
preg_match_all('/<img src="([^"]+)_SM.jpg"/i', file_get_contents($argv[1]), $matches);
foreach ($matches[1] as $key => $match)
{
$infile = $match.'_BG.jpg';
if ($data = file_get_contents($infile))
{
$outfile = sprintf('%05d', $key+1).'.jpg';
file_put_contents($outfile, $data);
echo "Saved ".$infile." as ".$outfile."\n";
}
else
{
echo "Warning: file not found: ".$infile."\n";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment