diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index a192b54c200..5f714a85bcd 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -5256,9 +5256,10 @@ class Form * @param string $cssclass CSS name to use on img for photo * @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 * @return string HTML code to output photo */ - static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin', $imagesize='', $addlinktofullsize=1) + static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin', $imagesize='', $addlinktofullsize=1, $cache=0) { global $conf,$langs; @@ -5274,8 +5275,8 @@ class Form $smallfile=preg_replace('/(\.png|\.gif|\.jpg|\.jpeg|\.bmp)/i','_small\\1',$smallfile); if (! empty($object->logo)) { - if ($imagesize == 'mini') $file=$id.'/logos/thumbs/'.getImageFileNameForSize($object->logo, '_mini'); - else if ($imagesize == 'small') $file=$id.'/logos/thumbs/'.getImageFileNameForSize($object->logo, '_small'); + if ((string) $imagesize == 'mini') $file=$id.'/logos/thumbs/'.getImageFileNameForSize($object->logo, '_mini'); + else if ((string) $imagesize == 'small') $file=$id.'/logos/thumbs/'.getImageFileNameForSize($object->logo, '_small'); else $file=$id.'/logos/thumbs/'.$smallfile; } } @@ -5284,8 +5285,8 @@ class Form $dir=$conf->societe->multidir_output[$entity].'/contact'; if (! empty($object->photo)) { - if ($imagesize == 'mini') $file=$id.'/photos/thumbs/'.getImageFileNameForSize($object->photo, '_mini'); - else if ($imagesize == 'small') $file=$id.'/photos/thumbs/'.getImageFileNameForSize($object->photo, '_small'); + if ((string) $imagesize == 'mini') $file=$id.'/photos/thumbs/'.getImageFileNameForSize($object->photo, '_mini'); + else if ((string) $imagesize == 'small') $file=$id.'/photos/thumbs/'.getImageFileNameForSize($object->photo, '_small'); else $file=$id.'/photos/'.$object->photo; } } @@ -5294,8 +5295,8 @@ class Form $dir=$conf->user->dir_output; if (! empty($object->photo)) { - if ($imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_mini'); - else if ($imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_small'); + if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_mini'); + else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, 'user').getImageFileNameForSize($object->photo, '_small'); else $file=get_exdir($id, 2, 0, 0, $object, 'user').$object->photo; } if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility @@ -5306,8 +5307,8 @@ class Form $dir=$conf->adherent->dir_output; if (! empty($object->photo)) { - if ($imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini'); - else if ($imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); + if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_mini'); + else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.getImageFileNameForSize($object->photo, '_small'); else $file=get_exdir($id, 2, 0, 0, $object, 'member').'photos/'.$object->photo; } if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility @@ -5316,14 +5317,18 @@ class Form else { $dir=$conf->$modulepart->dir_output; - if (! empty($object->photo)) $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo; + if (! empty($object->photo)) + { + if ((string) $imagesize == 'mini') $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_mini'); + else if ((string) $imagesize == 'small') $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.getImageFileNameForSize($object->photo, '_small'); + else $file=get_exdir($id, 2, 0, 0, $object, $modulepart).'photos/'.$object->photo; + } if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility $email=$object->email; } if ($dir) { - $cache='0'; if ($file && file_exists($dir."/".$file)) { if ($addlinktofullsize) $ret.=''; diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index d4358bb2b0a..f16af2ee72d 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -1886,7 +1886,7 @@ class User extends CommonObject if (! empty($this->photo)) { $label.= '
'; - $label.= Form::showphoto('userphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small'); + $label.= Form::showphoto('userphoto', $this, 80, 0, 0, 'photowithmargin photologintooltip', 'small', 0, 1); $label.= '
'; } @@ -1933,7 +1933,7 @@ class User extends CommonObject $paddafterimage=''; if (abs($withpictoimg) == 1) $paddafterimage='style="padding-right: 3px;"'; if ($withpictoimg > 0) $picto='
'.img_object('', 'user', $paddafterimage.' '.($notooltip?'':'class="classfortooltip"')).'
'; - else $picto='
'.Form::showphoto('userphoto', $this, 0, 0, 0, 'loginphoto', 0, 0, 'mini').'
'; + else $picto='
'.Form::showphoto('userphoto', $this, 0, 0, 0, 'loginphoto', 'mini', 0, 1).'
'; $result.=$picto; } if (abs($withpictoimg) != 2)