Less aggressive caching on thumbnails too.

This commit is contained in:
Thomas Tanghus 2012-06-06 01:04:59 +02:00
parent 68670bcc66
commit fce614b82c
1 changed files with 1 additions and 5 deletions

View File

@ -20,14 +20,12 @@
* *
*/ */
// Init owncloud
OCP\JSON::checkLoggedIn(); OCP\JSON::checkLoggedIn();
//OCP\User::checkLoggedIn(); //OCP\User::checkLoggedIn();
OCP\App::checkAppEnabled('contacts'); OCP\App::checkAppEnabled('contacts');
function getStandardImage(){ function getStandardImage(){
OCP\Response::setExpiresHeader('P10D'); //OCP\Response::setExpiresHeader('P10D');
OCP\Response::enableCaching(); OCP\Response::enableCaching();
OCP\Response::redirect(OCP\Util::imagePath('contacts', 'person.png')); OCP\Response::redirect(OCP\Util::imagePath('contacts', 'person.png'));
} }
@ -59,12 +57,10 @@ $image = new OC_Image();
$photo = $contact->getAsString('PHOTO'); $photo = $contact->getAsString('PHOTO');
if($photo) { if($photo) {
OCP\Response::setETagHeader(md5($photo)); OCP\Response::setETagHeader(md5($photo));
if($image->loadFromBase64($photo)) { if($image->loadFromBase64($photo)) {
if($image->centerCrop()) { if($image->centerCrop()) {
if($image->resize($thumbnail_size)) { if($image->resize($thumbnail_size)) {
if($image->show()) { if($image->show()) {
// done
exit(); exit();
} else { } else {
OCP\Util::writeLog('contacts','thumbnail.php. Couldn\'t display thumbnail for ID '.$id,OCP\Util::ERROR); OCP\Util::writeLog('contacts','thumbnail.php. Couldn\'t display thumbnail for ID '.$id,OCP\Util::ERROR);