forked from Wavyzz/dolibarr
Qual: Use a shared function to define logo heigth.
Qual: Add more phpunit tests Fix: This also solve overlapping logos.
This commit is contained in:
@@ -168,6 +168,27 @@ function pdf_getPDFFontSize($outputlangs)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return height to use for Logo onot PDF
|
||||
*
|
||||
* @param string $logo Full path to logo file to use
|
||||
* @return number
|
||||
*/
|
||||
function pdf_getHeightForLogo($logo)
|
||||
{
|
||||
$height=22; $maxwidth=130;
|
||||
include_once(DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php');
|
||||
$tmp=dol_getImageSize($logo);
|
||||
if ($tmp['height'])
|
||||
{
|
||||
$width=round($height*$tmp['width']/$tmp['height']);
|
||||
if ($width > $maxwidth) $height=$height*$maxwidth/$width;
|
||||
}
|
||||
//print $tmp['width'].' '.$tmp['height'].' '.$width; exit;
|
||||
return $height;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return a string with full address formated
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user