]> source.dussan.org Git - nextcloud-server.git/commitdiff
Don't try to load a profile picture for contacts the doesn't have any.
authorThomas Tanghus <thomas@tanghus.net>
Tue, 14 Feb 2012 00:11:21 +0000 (01:11 +0100)
committerThomas Tanghus <thomas@tanghus.net>
Tue, 14 Feb 2012 00:11:21 +0000 (01:11 +0100)
apps/contacts/thumbnail.php

index 39da6bc2bf73d2f831c56a980a318145c418326f..5082626499bacbd10fc33a58a19157dd4f8c7af0 100644 (file)
@@ -56,25 +56,26 @@ $thumbnail_size = 23;
 // Find the photo from VCard.
 $image = new OC_Image();
 $photo = $contact->getAsString('PHOTO');
+if($photo) {
+       OC_Response::setETagHeader(md5($photo));
 
-OC_Response::setETagHeader(md5($photo));
-
-if($image->loadFromBase64($photo)) {
-       if($image->centerCrop()) {
-               if($image->resize($thumbnail_size)) {
-                       if($image->show()) {
-                               // done
-                               exit();
+       if($image->loadFromBase64($photo)) {
+               if($image->centerCrop()) {
+                       if($image->resize($thumbnail_size)) {
+                               if($image->show()) {
+                                       // done
+                                       exit();
+                               } else {
+                                       OC_Log::write('contacts','thumbnail.php. Couldn\'t display thumbnail for ID '.$id,OC_Log::ERROR);
+                               }
                        } 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 resize thumbnail for ID '.$id,OC_Log::ERROR);
                        }
-               } else {
-                       OC_Log::write('contacts','thumbnail.php. Couldn\'t resize thumbnail for ID '.$id,OC_Log::ERROR);
+               }else{
+                       OC_Log::write('contacts','thumbnail.php. Couldn\'t crop thumbnail for ID '.$id,OC_Log::ERROR);
                }
-       }else{
-               OC_Log::write('contacts','thumbnail.php. Couldn\'t crop thumbnail for ID '.$id,OC_Log::ERROR);
+       } else {
+               OC_Log::write('contacts','thumbnail.php. Couldn\'t load image string for ID '.$id,OC_Log::ERROR);
        }
-} else {
-       OC_Log::write('contacts','thumbnail.php. Couldn\'t load image string for ID '.$id,OC_Log::ERROR);
 }
 getStandardImage();