Add option capture on input file for photo
This commit is contained in:
parent
ab8155f170
commit
cb89942bfb
@ -6674,16 +6674,17 @@ class Form
|
|||||||
* @param string $imagesize 'mini', 'small' or '' (original)
|
* @param string $imagesize 'mini', 'small' or '' (original)
|
||||||
* @param int $addlinktofullsize Add link to fullsize image
|
* @param int $addlinktofullsize Add link to fullsize image
|
||||||
* @param int $cache 1=Accept to use image in cache
|
* @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.
|
||||||
* @return string HTML code to output photo
|
* @return string HTML code to output photo
|
||||||
*/
|
*/
|
||||||
static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin', $imagesize='', $addlinktofullsize=1, $cache=0)
|
static function showphoto($modulepart, $object, $width=100, $height=0, $caneditfield=0, $cssclass='photowithmargin', $imagesize='', $addlinktofullsize=1, $cache=0, $forcecapture='')
|
||||||
{
|
{
|
||||||
global $conf,$langs;
|
global $conf,$langs;
|
||||||
|
|
||||||
$entity = (! empty($object->entity) ? $object->entity : $conf->entity);
|
$entity = (! empty($object->entity) ? $object->entity : $conf->entity);
|
||||||
$id = (! empty($object->id) ? $object->id : $object->rowid);
|
$id = (! empty($object->id) ? $object->id : $object->rowid);
|
||||||
|
|
||||||
$ret='';$dir='';$file='';$originalfile='';$altfile='';$email='';
|
$ret='';$dir='';$file='';$originalfile='';$altfile='';$email='';$capture='';
|
||||||
if ($modulepart=='societe')
|
if ($modulepart=='societe')
|
||||||
{
|
{
|
||||||
$dir=$conf->societe->multidir_output[$entity];
|
$dir=$conf->societe->multidir_output[$entity];
|
||||||
@ -6707,6 +6708,7 @@ class Form
|
|||||||
$originalfile=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.$object->photo;
|
$originalfile=get_exdir(0, 0, 0, 0, $object, 'contact').'/photos/'.$object->photo;
|
||||||
}
|
}
|
||||||
$email=$object->email;
|
$email=$object->email;
|
||||||
|
$capture='user';
|
||||||
}
|
}
|
||||||
else if ($modulepart=='userphoto')
|
else if ($modulepart=='userphoto')
|
||||||
{
|
{
|
||||||
@ -6720,6 +6722,7 @@ class Form
|
|||||||
}
|
}
|
||||||
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
|
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
|
||||||
$email=$object->email;
|
$email=$object->email;
|
||||||
|
$capture='user';
|
||||||
}
|
}
|
||||||
else if ($modulepart=='memberphoto')
|
else if ($modulepart=='memberphoto')
|
||||||
{
|
{
|
||||||
@ -6733,6 +6736,7 @@ class Form
|
|||||||
}
|
}
|
||||||
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
|
if (! empty($conf->global->MAIN_OLD_IMAGE_LINKS)) $altfile=$object->id.".jpg"; // For backward compatibility
|
||||||
$email=$object->email;
|
$email=$object->email;
|
||||||
|
$capture='user';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -6749,6 +6753,8 @@ class Form
|
|||||||
$email=$object->email;
|
$email=$object->email;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($forcecapture) $capture = $forcecapture;
|
||||||
|
|
||||||
if ($dir)
|
if ($dir)
|
||||||
{
|
{
|
||||||
if ($file && file_exists($dir."/".$file))
|
if ($file && file_exists($dir."/".$file))
|
||||||
@ -6805,7 +6811,7 @@ class Form
|
|||||||
if ($object->photo) $ret.="<br>\n";
|
if ($object->photo) $ret.="<br>\n";
|
||||||
$ret.='<table class="nobordernopadding centpercent">';
|
$ret.='<table class="nobordernopadding centpercent">';
|
||||||
if ($object->photo) $ret.='<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>';
|
if ($object->photo) $ret.='<tr><td><input type="checkbox" class="flat photodelete" name="deletephoto" id="photodelete"> '.$langs->trans("Delete").'<br><br></td></tr>';
|
||||||
$ret.='<tr><td class="tdoverflow"><input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput"></td></tr>';
|
$ret.='<tr><td class="tdoverflow"><input type="file" class="flat maxwidth200onsmartphone" name="photo" id="photoinput"'.($capture?' capture="'.$capture.'"':'').'></td></tr>';
|
||||||
$ret.='</table>';
|
$ret.='</table>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user