]> source.dussan.org Git - nextcloud-server.git/commitdiff
Avoid errors from missing GD library.
authorThomas Tanghus <thomas@tanghus.net>
Fri, 17 Feb 2012 18:04:12 +0000 (19:04 +0100)
committerThomas Tanghus <thomas@tanghus.net>
Sat, 18 Feb 2012 10:49:31 +0000 (11:49 +0100)
apps/contacts/photo.php

index 8dfbcb6fb107817833c5c9e72f2f39efc428d6ea..298f1215e3c467685b629cdd37d832093ba28a57 100644 (file)
@@ -13,10 +13,19 @@ require_once('../../lib/base.php');
 OC_Util::checkLoggedIn();
 OC_Util::checkAppEnabled('contacts');
 
+function getStandardImage(){
+       OC_Response::setExpiresHeader('P10D');
+       OC_Response::enableCaching();
+       OC_Response::redirect(OC_Helper::imagePath('contacts', 'person_large.png'));
+}
+
 $id = $_GET['id'];
 
 $contact = OC_Contacts_App::getContactVCard($id);
 $image = new OC_Image();
+if(!$image) {
+       getStandardImage();
+}
 // invalid vcard
 if( is_null($contact)) {
        OC_Log::write('contacts','photo.php. The VCard for ID '.$id.' is not RFC compatible',OC_Log::ERROR);
@@ -45,7 +54,8 @@ if( is_null($contact)) {
 }
 if (!$image->valid()) {
        // Not found :-(
-       $image->loadFromFile('img/person_large.png');
+       getStandardImage();
+       //$image->loadFromFile('img/person_large.png');
 }
 header('Content-Type: '.$image->mimeType());
 $image->show();