File: /home/dtptviut/domains/hyggestolen.dk/public_html/wp-content/plugins/external-images/ssl-proxy.php
<?php
if (empty($_GET['img'])) // Check if $_GET['img'] is not set AND is = '' (empty)
{
exit;
}
$image_url = $_GET['img'];
ini_set('gd.jpeg_ignore_warning', true);
if (stripos($image_url, '.jpg') !== false) {
$imagetype = 'image/jpeg';
} else if (stripos($image_url, '.jpeg') !== false) {
$imagetype = 'image/jpeg';
} else if (stripos($image_url, '.png') !== false) {
$imagetype = 'image/png';
} else if (stripos($image_url, '.gif') !== false) {
$imagetype = 'image/gif';
} else {
$checkmime = getimagesize($image_url);
if ($checkmime) {
$imagetype = $checkmime['mime'];
}
}
if (empty($imagetype)) {
die("We couldn't load the image file type. Either this is an invalid image, or your php.ini settings on your server needs the allow_url_fopen = On setting (instead of Off)");
}
if($imagetype != 'image/png' && $imagetype != 'image/gif' && $imagetype != 'image/jpeg') {
echo "failed to get image type";
die('not supported');
} else {
/*
echo "ready to try outputting image";
var_dump(ini_get('allow_url_fopen'));
exit;
$file = @ fopen($image_url, 'rb');
echo print_r($file, true);
exit;
header('Content-Type: ' . $imagetype);
header( 'Cache-Control: max-age=604800' );
if ($file) {
fpassthru($file);
exit;
}
*/
header('Content-Type: ' . $imagetype);
header( 'Cache-Control: max-age=604800' );
ob_clean();
readfile($image_url);
/* ob_clean();
readfile($image_url);
*/
}