File: /home/dtptviut/public_html/wp-content/plugins/comparisonfeed-wp/routers/image.php
<?php
/*
Router for banners
*/
error_reporting(E_ERROR);
include('../settings.php');
// Allow CORS and set headers.
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: *");
header("Cache-Control: max-age=31536000");
// Add Image header
$image = $_GET['image'];
$path_parts = pathinfo($image);
$extension = $path_parts['extension'];
// Special case for SVG content type.
if ($extension == 'svg') {
$extension .= '+xml';
}
header("Content-Type: image/".$extension);
// Get URL
$imageUrl = $imageDomain . $image;
$curl = curl_init();
$options = array(
CURLOPT_URL => $imageUrl,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_IPRESOLVE => CURL_IPRESOLVE_V4
);
curl_setopt_array($curl, $options);
$result = curl_exec($curl);
$httpCode = curl_getinfo($curl, CURLINFO_HTTP_CODE);
curl_close($curl);
// Generate ETag to facilitate caching.
$etag = md5($result);
if ($etag) {
header("ETag: " . $etag);
}
print $result;
?>