diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php
index a7bcc562a9b..15cfa9e5771 100644
--- a/htdocs/core/class/html.form.class.php
+++ b/htdocs/core/class/html.form.class.php
@@ -7493,10 +7493,11 @@ class Form
* @param string $imagesize 'mini', 'small' or '' (original)
* @param int $addlinktofullsize Add link to fullsize image
* @param int $cache 1=Accept to use image in cache
- * @param string $forcecapture Force parameter capture on HTML input file element to ask a smartphone to allow to open camera to take photo. Auto if empty.
+ * @param string $forcecapture '', 'user' or 'environment'. Force parameter capture on HTML input file element to ask a smartphone to allow to open camera to take photo. Auto if ''.
+ * @param int $noexternsourceoverwrite No overwrite image with extern source (like 'gravatar' or other module)
* @return string HTML code to output photo
*/
- public static function showphoto($modulepart, $object, $width = 100, $height = 0, $caneditfield = 0, $cssclass = 'photowithmargin', $imagesize = '', $addlinktofullsize = 1, $cache = 0, $forcecapture = '')
+ public static function showphoto($modulepart, $object, $width = 100, $height = 0, $caneditfield = 0, $cssclass = 'photowithmargin', $imagesize = '', $addlinktofullsize = 1, $cache = 0, $forcecapture = '', $noexternsourceoverwrite = 0)
{
global $conf, $langs;
@@ -7573,18 +7574,15 @@ class Form
{
if ($file && file_exists($dir."/".$file))
{
- if ($addlinktofullsize)
- {
+ if ($addlinktofullsize) {
$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
if ($urladvanced) $ret .= '';
else $ret .= '';
}
$ret .= '';
if ($addlinktofullsize) $ret .= '';
- } elseif ($altfile && file_exists($dir."/".$altfile))
- {
- if ($addlinktofullsize)
- {
+ } elseif ($altfile && file_exists($dir."/".$altfile)) {
+ if ($addlinktofullsize) {
$urladvanced = getAdvancedPreviewUrl($modulepart, $originalfile, 0, '&entity='.$entity);
if ($urladvanced) $ret .= '';
else $ret .= '';
@@ -7593,8 +7591,7 @@ class Form
if ($addlinktofullsize) $ret .= '';
} else {
$nophoto = '/public/theme/common/nophoto.png';
- if (in_array($modulepart, array('userphoto', 'contact', 'memberphoto'))) // For module that are "physical" users
- {
+ if (in_array($modulepart, array('userphoto', 'contact', 'memberphoto'))) { // For module that are "physical" users
if ($modulepart == 'memberphoto' && strpos($object->morphy, 'mor') !== false) {
$nophoto = '/public/theme/common/company.png';
} else {
@@ -7604,11 +7601,8 @@ class Form
}
}
- if (!empty($conf->gravatar->enabled) && $email)
- {
- /**
- * @see https://gravatar.com/site/implement/images/php/
- */
+ if (!empty($conf->gravatar->enabled) && $email && empty($noexternsourceoverwrite)) {
+ // see https://gravatar.com/site/implement/images/php/
global $dolibarr_main_url_root;
$ret .= '';
//$defaultimg=urlencode(dol_buildpath($nophoto,3));
diff --git a/htdocs/user/card.php b/htdocs/user/card.php
index b767be807ff..0885809de78 100644
--- a/htdocs/user/card.php
+++ b/htdocs/user/card.php
@@ -2475,7 +2475,7 @@ if ($action == 'create' || $action == 'adduserldap')
print '