From 7e70d935b6567f91edc9dbdbcdc7ad1f39788c51 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Wed, 3 Jul 2013 16:06:42 +0200 Subject: [PATCH] Fix: change for use url of image --- htdocs/core/lib/images.lib.php | 11 ++++++++--- htdocs/core/lib/pdf.lib.php | 5 +++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/images.lib.php b/htdocs/core/lib/images.lib.php index 9df392a66eb..7dea7357535 100644 --- a/htdocs/core/lib/images.lib.php +++ b/htdocs/core/lib/images.lib.php @@ -65,16 +65,21 @@ function image_format_supported($file) * Return size of image file on disk (Supported extensions are gif, jpg, png and bmp) * * @param string $file Full path name of file + * @param bool $url Image with url (true or false) * @return array array('width'=>width, 'height'=>height) */ -function dol_getImageSize($file) +function dol_getImageSize($file, $url = false) { $ret=array(); if (image_format_supported($file) < 0) return $ret; - $fichier = realpath($file); // Chemin canonique absolu de l'image - $dir = dirname($file); // Chemin du dossier contenant l'image + $fichier = $file; + if (!$url) + { + $fichier = realpath($file); // Chemin canonique absolu de l'image + $dir = dirname($file); // Chemin du dossier contenant l'image + } $infoImg = getimagesize($fichier); // Recuperation des infos de l'image $ret['width']=$infoImg[0]; // Largeur de l'image diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 0a4842ec0fd..bc57083718a 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -227,13 +227,14 @@ function pdf_getPDFFontSize($outputlangs) * Return height to use for Logo onot PDF * * @param string $logo Full path to logo file to use + * @param bool $url Image with url (true or false) * @return number */ -function pdf_getHeightForLogo($logo) +function pdf_getHeightForLogo($logo, $url = false) { $height=22; $maxwidth=130; include_once DOL_DOCUMENT_ROOT.'/core/lib/images.lib.php'; - $tmp=dol_getImageSize($logo); + $tmp=dol_getImageSize($logo, $url); if ($tmp['height']) { $width=round($height*$tmp['width']/$tmp['height']);