mirror of
https://github.com/owncloudarchive/contacts.git
synced 2025-02-07 01:54:16 +01:00
Contacts: Optimize thumbnail cache handling a bit
This commit is contained in:
parent
96ee0ceca3
commit
774eb66110
@ -43,11 +43,12 @@ $id = $_GET['id'];
|
|||||||
$contact = OC_Contacts_App::getContactVCard($id);
|
$contact = OC_Contacts_App::getContactVCard($id);
|
||||||
|
|
||||||
// invalid vcard
|
// invalid vcard
|
||||||
if( is_null($contact)){
|
if(is_null($contact)){
|
||||||
OC_Log::write('contacts','thumbnail.php. The VCard for ID '.$id.' is not RFC compatible',OC_Log::ERROR);
|
OC_Log::write('contacts','thumbnail.php. The VCard for ID '.$id.' is not RFC compatible',OC_Log::ERROR);
|
||||||
getStandardImage();
|
getStandardImage();
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
OC_Contacts_App::setLastModifiedHeader($contact);
|
||||||
|
|
||||||
$thumbnail_size = 23;
|
$thumbnail_size = 23;
|
||||||
|
|
||||||
@ -56,12 +57,12 @@ $image = new OC_Image();
|
|||||||
$photo = $contact->getAsString('PHOTO');
|
$photo = $contact->getAsString('PHOTO');
|
||||||
|
|
||||||
OC_Response::setETagHeader(md5($photo));
|
OC_Response::setETagHeader(md5($photo));
|
||||||
OC_Contacts_App::setLastModifiedHeader($contact);
|
|
||||||
|
|
||||||
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 {
|
||||||
OC_Log::write('contacts','thumbnail.php. Couldn\'t display thumbnail for ID '.$id,OC_Log::ERROR);
|
OC_Log::write('contacts','thumbnail.php. Couldn\'t display thumbnail for ID '.$id,OC_Log::ERROR);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user