loaep

Customer
when you have https on your forum, and someone posts an image that uses http, you lose ur https on that page. my idea is to pretty much download all images and save them internaly. or even 'GET' them and cache them. Here is the code I've made up to nearly emulate it:

Code:
<?php

session_start(); 
header("Cache-Control: private, max-age=10800, pre-check=10800");
header("Pragma: private");
header("Expires: " . date(DATE_RFC822,strtotime(" 2 day")));
$file = isset($_GET['img']) && !empty($_GET['img']) ? $_GET['img'] : false;

if(!$file) {
  echo 'Invalid IMG URL';
  exit;
}

$ext = substr(strrchr($file, '.'), 1);

switch($ext) {
  case 'jpg': case 'jpe': case 'jpeg':
    $type = 'jpeg';
    break;
  case 'png':
    $type = 'png';
    break;
  case 'gif':
    $type = 'gif';
    break;
  default:
    $type = 'jpeg';
    break;
}

header('Content-type: image/'. $type);
readfile(htmlspecialchars($file));
?>
But it doesnt cache.

So yeah, I think that would be a good mod.
 
Back
Top