getscraperfilters("images");
$get = $frontend->parsegetfilters($_GET, $filters);
$frontend->loadheader(
$get,
$filters,
"images"
);
$payload = [
"images" => "",
"nextpage" => ""
];
try{
$results = $scraper->image($get);
}catch(Exception $error){
echo
$frontend->drawerror(
"Shit",
'This scraper returned an error:' .
'
' . htmlspecialchars($error->getMessage()) . '
' .
'Things you can try:' .
'' .
'- Use a different scraper
' .
'- Remove keywords that could cause errors
' .
'- Use another 4get instance
' .
'
' .
'If the error persists, please contact the administrator.'
);
die();
}
if(count($results["image"]) === 0){
$payload["images"] =
'' .
"
Nobody here but us chickens!
" .
'Have you tried:' .
'
' .
'- Using a different scraper
' .
'- Using fewer keywords
' .
'- Defining broader filters (Is NSFW turned off?)
' .
'
' .
'
';
}
foreach($results["image"] as $image){
$domain = htmlspecialchars(parse_url($image["url"], PHP_URL_HOST));
$c = count($image["source"]) - 1;
if(
preg_match(
'/^data:/',
$image["source"][$c]["url"]
)
){
$src = htmlspecialchars($image["source"][$c]["url"]);
}else{
$src = "/proxy?i=" . urlencode($image["source"][$c]["url"]) . "&s=thumb";
}
$payload["images"] .=
'';
}
if($results["npt"] !== null){
$payload["nextpage"] =
'Next page >';
}
echo $frontend->load("images.html", $payload);