Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
mass image scanner (2008)
//Mass image scanner for URLs.
//Valid known prefixes: DSC, DSCN, DSCF, DSC_, DSC, IMG, IMG_, Photo, PIC
//Valid suffixes: .jpg, .png (etc, keep in mind on linux servers file names are case sensitive, so searching for .JPG, .PNG may be useful, but cameras usually save them as lowercase .jpg), _DSCN.jpg (in rare cases)
//For more suffixes or prefixes read up on
//Optimal usage: /scan_pics.php?url=
//You must edit the URL to your own likings.
//In the demonstration it was used on this URL with the DSC prefix although it only finds one photo.
//Additional parameters: &start=0, &end=9999 (most cameras only go up to 9999 so there's no point in going higher)
//The additional parameters are also good for certain number scans, i.e. from 600 to 699, such as trying to find a set of photos.
//All files that don't exist will error, any files that are found will appear as normal images.
//The page will take extremely long to load on a normal 0-9999 scan, you'll only know what has loaded and what hasn't when it's done loading.
//Functions used by script
function zerofill($mStretch, $iLength = 2)
$sPrintfString = '%0' . (int)$iLength . 's';
return sprintf($sPrintfString, $mStretch);
$start = $_GET['start'];
$start = 0;
if($_GET['end'] <= 9999){
$end = $_GET['end'];
$end = 9999;
$end = 9999;
$url = $_GET['url'];
die('No parameters specified.');
$prefix = $_GET['prefix'];
$prefix = null;
$suffix = $_GET['suffix'];
$suffix = '.jpg';
echo '<title>Scanning images from '.$prefix.$start.$suffix.' to '.$prefix.$end.$suffix.'.</title>';
for($i=$start;$i<$end + 1;$i++){
echo '<img src="'.$url.$prefix.zerofill($i,strlen($end)).$suffix.'" width="100" height="100" />';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment