Added redirecting to static image file and caching for contacts with no photo embedded.

This commit is contained in:
Thomas Tanghus 2012-01-19 16:00:41 +01:00
parent ce13b3b7cd
commit dc942d6f3e

View file

@ -22,7 +22,8 @@
// Init owncloud // Init owncloud
require_once('../../lib/base.php'); require_once('../../lib/base.php');
OC_Util::checkLoggedIn(); OC_JSON::checkLoggedIn();
//OC_Util::checkLoggedIn();
OC_Util::checkAppEnabled('contacts'); OC_Util::checkAppEnabled('contacts');
if(!function_exists('imagecreatefromjpeg')) { if(!function_exists('imagecreatefromjpeg')) {
@ -33,10 +34,16 @@ if(!function_exists('imagecreatefromjpeg')) {
} }
function getStandardImage(){ function getStandardImage(){
$src_img = imagecreatefrompng('img/person.png'); $date = new DateTime('now');
header('Content-Type: image/png'); $date->add(new DateInterval('P10D'));
imagepng($src_img); header('Expires: '.$date->format(DateTime::RFC850));
imagedestroy($src_img); header('Cache-Control: cache');
header('Location: '.OC_Helper::imagePath('contacts', 'person.png'));
exit();
// $src_img = imagecreatefrompng('img/person.png');
// header('Content-Type: image/png');
// imagepng($src_img);
// imagedestroy($src_img);
} }