CRM-21778 - Contact image uploaded from drupal webform don't render on summary page
authorJitendra Purohit <jitendra@fuzion.co.nz>
Fri, 16 Feb 2018 09:39:19 +0000 (15:09 +0530)
committerJitendra Purohit <jitendra@fuzion.co.nz>
Fri, 16 Feb 2018 09:39:19 +0000 (15:09 +0530)
CRM/Utils/File.php

index b23cacf128c39ad5593a6e3d9e29f9edbb8fbeb6..0d2d91f6313dbb4724fc97885fac06131f9d72b7 100644 (file)
@@ -910,10 +910,16 @@ HTACCESS;
     $imageURL = CRM_Utils_String::unstupifyUrl($imageURL);
     parse_str(parse_url($imageURL, PHP_URL_QUERY), $query);
 
-    $path = CRM_Core_Config::singleton()->customFileUploadDir . $query['photo'];
+    $url = NULL;
+    if (!empty($query['photo'])) {
+      $path = CRM_Core_Config::singleton()->customFileUploadDir . $query['photo'];
+    }
+    else {
+      $path = $url = $imageURL;
+    }
     $mimeType = 'image/' . strtolower(pathinfo($path, PATHINFO_EXTENSION));
 
-    return self::getFileURL($path, $mimeType);
+    return self::getFileURL($path, $mimeType, $url);
   }
 
   /**