forked from Wavyzz/dolibarr
Qual: Reorganize lib functions:
All lib php files are called .lib.php Image functions are stored in images.lib.php
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
require_once(DOL_DOCUMENT_ROOT."/lib/company.lib.php");
|
||||||
|
require_once(DOL_DOCUMENT_ROOT."/lib/images.lib.php");
|
||||||
|
|
||||||
$langs->load("admin");
|
$langs->load("admin");
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
@@ -34,6 +35,7 @@ $langs->load("companies");
|
|||||||
if (!$user->admin)
|
if (!$user->admin)
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
|
|
||||||
|
|
||||||
if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
|
if ( (isset($_POST["action"]) && $_POST["action"] == 'update')
|
||||||
|| (isset($_POST["action"]) && $_POST["action"] == 'updateedit') )
|
|| (isset($_POST["action"]) && $_POST["action"] == 'updateedit') )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ class Conf
|
|||||||
*/
|
*/
|
||||||
function setValues($db)
|
function setValues($db)
|
||||||
{
|
{
|
||||||
dolibarr_syslog("functions.inc.php::setValues");
|
dolibarr_syslog("Conf::setValues");
|
||||||
|
|
||||||
// Par defaut, a oui
|
// Par defaut, a oui
|
||||||
$this->global->PRODUIT_CONFIRM_DELETE_LINE=1;
|
$this->global->PRODUIT_CONFIRM_DELETE_LINE=1;
|
||||||
|
|||||||
@@ -17,19 +17,16 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
* or see http://www.gnu.org/
|
* or see http://www.gnu.org/
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/expedition/mods/pdf/ModelePdfExpedition.class.php
|
\file htdocs/expedition/mods/pdf/ModelePdfExpedition.class.php
|
||||||
\ingroup shipping
|
\ingroup shipping
|
||||||
\brief Fichier contenant la classe m<>re de generation des expeditions
|
\brief Fichier contenant la classe m<>re de generation des expeditions
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.inc.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||||
require_once DOL_DOCUMENT_ROOT.'/includes/fpdf/DolibarrPdfBarCode.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/includes/fpdf/DolibarrPdfBarCode.class.php';
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,17 +15,13 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/fourn/product/photos.php
|
\file htdocs/fourn/product/photos.php
|
||||||
\ingroup product
|
\ingroup product
|
||||||
\brief Page de la fiche produit
|
\brief Page de la fiche produit
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require("./pre.inc.php");
|
require("./pre.inc.php");
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php");
|
require_once(DOL_DOCUMENT_ROOT ."/html.form.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.inc.php");
|
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php");
|
||||||
|
|
||||||
|
|
||||||
/** \class FormMail
|
/** \class FormMail
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ define('DOL_URL_ROOT', $pos);
|
|||||||
/*
|
/*
|
||||||
$conf->syslog->enabled=1;
|
$conf->syslog->enabled=1;
|
||||||
define('SYSLOG_FILE','c:/log/dolibarr/dolibarr.log');
|
define('SYSLOG_FILE','c:/log/dolibarr/dolibarr.log');
|
||||||
require_once("../../../../../../../../lib/functions.inc.php");
|
require_once("../../../../../../../../lib/functions.lib.php");
|
||||||
dolibarr_syslog("eee".$conf->fckeditor->dir_output);
|
dolibarr_syslog("eee".$conf->fckeditor->dir_output);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@@ -18,18 +18,16 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
* or see http://www.gnu.org/
|
* or see http://www.gnu.org/
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/includes/modules/barcode/modules_barcode.php
|
\file htdocs/includes/modules/barcode/modules_barcode.php
|
||||||
\ingroup barcode
|
\ingroup barcode
|
||||||
\brief Fichier contenant la classe m<>re de generation des codes barres
|
\brief Fichier contenant la classe m<>re de generation des codes barres
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.inc.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,10 +18,6 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
* or see http://www.gnu.org/
|
* or see http://www.gnu.org/
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -29,10 +25,10 @@
|
|||||||
\ingroup commande
|
\ingroup commande
|
||||||
\brief Fichier contenant la classe m<>re de generation des commandes en PDF
|
\brief Fichier contenant la classe m<>re de generation des commandes en PDF
|
||||||
et la classe m<>re de num<75>rotation des commandes
|
et la classe m<>re de num<75>rotation des commandes
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.inc.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // requis car utilise par les classes qui heritent
|
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // requis car utilise par les classes qui heritent
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
|
require_once(DOL_DOCUMENT_ROOT.'/discount.class.php');
|
||||||
|
|||||||
@@ -27,7 +27,7 @@
|
|||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.inc.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/don.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/don.class.php");
|
||||||
|
|
||||||
|
|||||||
@@ -16,19 +16,16 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
* or see http://www.gnu.org/
|
* or see http://www.gnu.org/
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/includes/modules/export/modules_export.php
|
\file htdocs/includes/modules/export/modules_export.php
|
||||||
\ingroup export
|
\ingroup export
|
||||||
\brief Fichier contenant la classe m<>re de generation des exports
|
\brief Fichier contenant la classe m<>re de generation des exports
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.inc.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -18,9 +18,6 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
* or see http://www.gnu.org/
|
* or see http://www.gnu.org/
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -28,10 +25,10 @@
|
|||||||
\ingroup facture
|
\ingroup facture
|
||||||
\brief Fichier contenant la classe m<>re de generation des factures en PDF
|
\brief Fichier contenant la classe m<>re de generation des factures en PDF
|
||||||
et la classe m<>re de num<75>rotation des factures
|
et la classe m<>re de num<75>rotation des factures
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.inc.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
require_once(DOL_DOCUMENT_ROOT."/product.class.php");
|
||||||
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // Requis car utilis<69> dans les classes qui h<>ritent
|
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // Requis car utilis<69> dans les classes qui h<>ritent
|
||||||
|
|||||||
@@ -16,10 +16,6 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
* or see http://www.gnu.org/
|
* or see http://www.gnu.org/
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -27,10 +23,10 @@
|
|||||||
\ingroup ficheinter
|
\ingroup ficheinter
|
||||||
\brief Fichier contenant la classe m<>re de generation des fiches interventions en PDF
|
\brief Fichier contenant la classe m<>re de generation des fiches interventions en PDF
|
||||||
et la classe m<>re de num<75>rotation des fiches interventions
|
et la classe m<>re de num<75>rotation des fiches interventions
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.inc.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.inc.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -26,7 +26,7 @@
|
|||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.inc.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // Requis car utilis<69> dans les classes qui h<>ritent
|
require_once(DOL_DOCUMENT_ROOT."/compta/bank/account.class.php"); // Requis car utilis<69> dans les classes qui h<>ritent
|
||||||
|
|
||||||
|
|||||||
@@ -15,19 +15,16 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
* or see http://www.gnu.org/
|
* or see http://www.gnu.org/
|
||||||
*
|
|
||||||
* $Id$
|
|
||||||
* $Source$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/includes/modules/facture/modules_genpassword.php
|
\file htdocs/includes/modules/facture/modules_genpassword.php
|
||||||
\ingroup core
|
\ingroup core
|
||||||
\brief Fichier contenant la classe m<>re de generation des mots de passe
|
\brief Fichier contenant la classe m<>re de generation des mots de passe
|
||||||
\version $Revision$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.inc.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ if ($_POST["action"] == "set" || $_POST["action"] == "upgrade")
|
|||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
// on d<>code le mot de passe de la base si besoin
|
// on d<>code le mot de passe de la base si besoin
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.inc.php");
|
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php");
|
||||||
if (isset($dolibarr_main_db_encrypted_pass) && $dolibarr_main_db_encrypted_pass) $dolibarr_main_db_pass = dolibarr_decode($dolibarr_main_db_encrypted_pass);
|
if (isset($dolibarr_main_db_encrypted_pass) && $dolibarr_main_db_encrypted_pass) $dolibarr_main_db_pass = dolibarr_decode($dolibarr_main_db_encrypted_pass);
|
||||||
|
|
||||||
$conf->db->type = $dolibarr_main_db_type;
|
$conf->db->type = $dolibarr_main_db_type;
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
require_once('../translate.class.php');
|
require_once('../translate.class.php');
|
||||||
require_once('../lib/functions.inc.php');
|
require_once('../lib/functions.lib.php');
|
||||||
require_once('../lib/admin.lib.php');
|
require_once('../lib/admin.lib.php');
|
||||||
|
|
||||||
// DOL_DOCUMENT_ROOT has been defined in function.inc.php to '..'
|
// DOL_DOCUMENT_ROOT has been defined in function.inc.php to '..'
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
\file htdocs/lib/functions.inc.php
|
\file htdocs/lib/functions.lib.php
|
||||||
\brief Ensemble de fonctions de base de dolibarr sous forme d'include
|
\brief Ensemble de fonctions de base de dolibarr sous forme d'include
|
||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
@@ -295,7 +295,7 @@ function dolibarr_set_user_page_param($db, &$user, $url='', $tab)
|
|||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
$sql.= ")";
|
$sql.= ")";
|
||||||
dolibarr_syslog("functions.inc.php::dolibarr_set_user_page_param $sql");
|
dolibarr_syslog("functions.lib.php::dolibarr_set_user_page_param $sql");
|
||||||
|
|
||||||
$resql=$db->query($sql);
|
$resql=$db->query($sql);
|
||||||
if (! $resql)
|
if (! $resql)
|
||||||
@@ -315,7 +315,7 @@ function dolibarr_set_user_page_param($db, &$user, $url='', $tab)
|
|||||||
if ($url) $sql.= " '".urlencode($url)."',";
|
if ($url) $sql.= " '".urlencode($url)."',";
|
||||||
else $sql.= " '',";
|
else $sql.= " '',";
|
||||||
$sql.= " '".$key."','".addslashes($value)."');";
|
$sql.= " '".$key."','".addslashes($value)."');";
|
||||||
dolibarr_syslog("functions.inc.php::dolibarr_set_user_page_param $sql");
|
dolibarr_syslog("functions.lib.php::dolibarr_set_user_page_param $sql");
|
||||||
|
|
||||||
$result=$db->query($sql);
|
$result=$db->query($sql);
|
||||||
if (! $result)
|
if (! $result)
|
||||||
@@ -1345,7 +1345,7 @@ function restrictedArea($user, $feature='societe', $objectid=0, $dbtablename='')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_syslog("Functions.inc.php::restrictedArea sql=".$sql, LOG_ERROR);
|
dolibarr_syslog("functions.lib.php::restrictedArea sql=".$sql, LOG_ERROR);
|
||||||
accessforbidden();
|
accessforbidden();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2151,7 +2151,7 @@ function get_exdir($num,$level=3)
|
|||||||
*/
|
*/
|
||||||
function create_exdir($dir)
|
function create_exdir($dir)
|
||||||
{
|
{
|
||||||
dolibarr_syslog("functions.inc.php::create_exdir: dir=$dir",LOG_INFO);
|
dolibarr_syslog("functions.lib.php::create_exdir: dir=$dir",LOG_INFO);
|
||||||
|
|
||||||
if (@is_dir($dir)) return 0;
|
if (@is_dir($dir)) return 0;
|
||||||
|
|
||||||
@@ -2172,18 +2172,18 @@ function create_exdir($dir)
|
|||||||
{
|
{
|
||||||
if (! @is_dir($ccdir))
|
if (! @is_dir($ccdir))
|
||||||
{
|
{
|
||||||
dolibarr_syslog("functions.inc.php::create_exdir: Directory '".$ccdir."' does not exists or is outside open_basedir PHP setting.",LOG_DEBUG);
|
dolibarr_syslog("functions.lib.php::create_exdir: Directory '".$ccdir."' does not exists or is outside open_basedir PHP setting.",LOG_DEBUG);
|
||||||
|
|
||||||
umask(0);
|
umask(0);
|
||||||
if (! @mkdir($ccdir, 0755))
|
if (! @mkdir($ccdir, 0755))
|
||||||
{
|
{
|
||||||
// Si le is_dir a renvoyé une fausse info, alors on passe ici.
|
// Si le is_dir a renvoyé une fausse info, alors on passe ici.
|
||||||
dolibarr_syslog("functions.inc.php::create_exdir: Fails to create directory '".$ccdir."' or directory already exists.",LOG_WARNING);
|
dolibarr_syslog("functions.lib.php::create_exdir: Fails to create directory '".$ccdir."' or directory already exists.",LOG_WARNING);
|
||||||
$nberr++;
|
$nberr++;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dolibarr_syslog("functions.inc.php::create_exdir: Directory '".$ccdir."' created",LOG_DEBUG);
|
dolibarr_syslog("functions.lib.php::create_exdir: Directory '".$ccdir."' created",LOG_DEBUG);
|
||||||
$nberr=0; // On remet a zéro car si on arrive ici, cela veut dire que les échecs précédents peuvent etre ignorés
|
$nberr=0; // On remet a zéro car si on arrive ici, cela veut dire que les échecs précédents peuvent etre ignorés
|
||||||
$nbcreated++;
|
$nbcreated++;
|
||||||
}
|
}
|
||||||
@@ -2211,7 +2211,7 @@ function create_exdir($dir)
|
|||||||
*/
|
*/
|
||||||
function dolibarr_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC)
|
function dolibarr_dir_list($path, $types="all", $recursive=0, $filter="", $excludefilter="", $sortcriteria="name", $sortorder=SORT_ASC)
|
||||||
{
|
{
|
||||||
dolibarr_syslog("functions.inc.php::dolibarr_dir_list $path");
|
dolibarr_syslog("functions.lib.php::dolibarr_dir_list $path");
|
||||||
|
|
||||||
$loaddate=false;
|
$loaddate=false;
|
||||||
$loadsize=false;
|
$loadsize=false;
|
||||||
@@ -2917,219 +2917,6 @@ function print_date_range($date_start,$date_end)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* \brief Création de 2 vignettes a partir d'un fichier image (une small et un mini)
|
|
||||||
* \brief Les extension prise en compte sont jpg et png
|
|
||||||
* \param file Chemin du fichier image a redimensionner
|
|
||||||
* \param maxWidth Largeur maximum que dois faire la miniature (160 par défaut)
|
|
||||||
* \param maxHeight Hauteur maximum que dois faire l'image (120 par défaut)
|
|
||||||
* \param extName Extension pour différencier le nom de la vignette
|
|
||||||
* \param quality Qualité de compression (0=worst, 100=best)
|
|
||||||
* \return string Chemin de la vignette
|
|
||||||
*/
|
|
||||||
function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $quality=50)
|
|
||||||
{
|
|
||||||
global $langs;
|
|
||||||
|
|
||||||
dolibarr_syslog("functions.inc::vignette file=".$file." extName=".$extName." maxWidth=".$maxWidth." maxHeight=".$maxHeight." quality=".$quality);
|
|
||||||
|
|
||||||
// Nettoyage parametres
|
|
||||||
$file=trim($file);
|
|
||||||
|
|
||||||
// Vérification des paramétres
|
|
||||||
if (! $file)
|
|
||||||
{
|
|
||||||
// Si le fichier n'a pas été indiqué
|
|
||||||
return 'Bad parameter file';
|
|
||||||
}
|
|
||||||
elseif (! file_exists($file))
|
|
||||||
{
|
|
||||||
// Si le fichier passé en paramétre n'existe pas
|
|
||||||
return $langs->trans("ErrorFileNotFound",$file);
|
|
||||||
}
|
|
||||||
elseif(image_format_supported($file) < 0)
|
|
||||||
{
|
|
||||||
return 'This file '.$file.' does not seem to be an image format file name.';
|
|
||||||
}
|
|
||||||
elseif(!is_numeric($maxWidth) || empty($maxWidth) || $maxWidth < 0){
|
|
||||||
// Si la largeur max est incorrecte (n'est pas numérique, est vide, ou est inférieure a 0)
|
|
||||||
return 'Valeur de la largeur incorrecte.';
|
|
||||||
}
|
|
||||||
elseif(!is_numeric($maxHeight) || empty($maxHeight) || $maxHeight < 0){
|
|
||||||
// Si la hauteur max est incorrecte (n'est pas numérique, est vide, ou est inférieure a 0)
|
|
||||||
return 'Valeur de la hauteur incorrecte.';
|
|
||||||
}
|
|
||||||
|
|
||||||
$fichier = realpath($file); // Chemin canonique absolu de l'image
|
|
||||||
$dir = dirname($file).'/'; // Chemin du dossier contenant l'image
|
|
||||||
$dirthumb = $dir.'thumbs/'; // Chemin du dossier contenant les vignettes
|
|
||||||
|
|
||||||
$infoImg = getimagesize($fichier); // Récupération des infos de l'image
|
|
||||||
$imgWidth = $infoImg[0]; // Largeur de l'image
|
|
||||||
$imgHeight = $infoImg[1]; // Hauteur de l'image
|
|
||||||
|
|
||||||
// Si l'image est plus petite que la largeur et la hauteur max, on ne crée pas de vignette
|
|
||||||
if ($infoImg[0] < $maxWidth && $infoImg[1] < $maxHeight)
|
|
||||||
{
|
|
||||||
// On cree toujours les vignettes
|
|
||||||
dolibarr_syslog("File size is smaller than thumb size",LOG_DEBUG);
|
|
||||||
//return 'Le fichier '.$file.' ne nécessite pas de création de vignette';
|
|
||||||
}
|
|
||||||
|
|
||||||
$imgfonction='';
|
|
||||||
switch($infoImg[2])
|
|
||||||
{
|
|
||||||
case 1: // IMG_GIF
|
|
||||||
$imgfonction = 'imagecreatefromgif';
|
|
||||||
break;
|
|
||||||
case 2: // IMG_JPG
|
|
||||||
$imgfonction = 'imagecreatefromjpeg';
|
|
||||||
break;
|
|
||||||
case 3: // IMG_PNG
|
|
||||||
$imgfonction = 'imagecreatefrompng';
|
|
||||||
break;
|
|
||||||
case 4: // IMG_WBMP
|
|
||||||
$imgfonction = 'imagecreatefromwbmp';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ($imgfonction)
|
|
||||||
{
|
|
||||||
if (! function_exists($imgfonction))
|
|
||||||
{
|
|
||||||
// Fonctions de conversion non presente dans ce PHP
|
|
||||||
return 'Creation de vignette impossible. Ce PHP ne supporte pas les fonctions du module GD '.$imgfonction;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// On crée le répertoire contenant les vignettes
|
|
||||||
if (! file_exists($dirthumb))
|
|
||||||
{
|
|
||||||
create_exdir($dirthumb);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialisation des variables selon l'extension de l'image
|
|
||||||
switch($infoImg[2])
|
|
||||||
{
|
|
||||||
case 1: // Gif
|
|
||||||
$img = imagecreatefromgif($fichier);
|
|
||||||
$extImg = '.gif'; // Extension de l'image
|
|
||||||
$newquality='NU';
|
|
||||||
break;
|
|
||||||
case 2: // Jpg
|
|
||||||
$img = imagecreatefromjpeg($fichier);
|
|
||||||
$extImg = '.jpg'; // Extension de l'image
|
|
||||||
$newquality=$quality;
|
|
||||||
break;
|
|
||||||
case 3: // Png
|
|
||||||
$img = imagecreatefrompng($fichier);
|
|
||||||
$extImg = '.png';
|
|
||||||
$newquality=$quality-100;
|
|
||||||
$newquality=round(abs($quality-100)*9/100);
|
|
||||||
break;
|
|
||||||
case 4: // Bmp
|
|
||||||
$img = imagecreatefromwbmp($fichier);
|
|
||||||
$extImg = '.bmp';
|
|
||||||
$newquality='NU';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialisation des dimensions de la vignette si elles sont supérieures a l'original
|
|
||||||
if($maxWidth > $imgWidth){ $maxWidth = $imgWidth; }
|
|
||||||
if($maxHeight > $imgHeight){ $maxHeight = $imgHeight; }
|
|
||||||
|
|
||||||
$whFact = $maxWidth/$maxHeight; // Facteur largeur/hauteur des dimensions max de la vignette
|
|
||||||
$imgWhFact = $imgWidth/$imgHeight; // Facteur largeur/hauteur de l'original
|
|
||||||
|
|
||||||
// Fixe les dimensions de la vignette
|
|
||||||
if($whFact < $imgWhFact){
|
|
||||||
// Si largeur déterminante
|
|
||||||
$thumbWidth = $maxWidth;
|
|
||||||
$thumbHeight = $thumbWidth / $imgWhFact;
|
|
||||||
} else {
|
|
||||||
// Si hauteur déterminante
|
|
||||||
$thumbHeight = $maxHeight;
|
|
||||||
$thumbWidth = $thumbHeight * $imgWhFact;
|
|
||||||
}
|
|
||||||
$thumbHeight=round($thumbHeight);
|
|
||||||
$thumbWidth=round($thumbWidth);
|
|
||||||
|
|
||||||
// Create empty image
|
|
||||||
if ($infoImg[2] == 1)
|
|
||||||
{
|
|
||||||
// Compatibilité image GIF
|
|
||||||
$imgThumb = imagecreate($thumbWidth, $thumbHeight);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$imgThumb = imagecreatetruecolor($thumbWidth, $thumbHeight);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Activate antialiasing for better quality
|
|
||||||
if (function_exists('imageantialias'))
|
|
||||||
{
|
|
||||||
imageantialias($imgThumb, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// This is to keep transparent alpha channel if exists (PHP >= 4.2)
|
|
||||||
if (function_exists('imagesavealpha'))
|
|
||||||
{
|
|
||||||
imagesavealpha($imgThumb, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialisation des variables selon l'extension de l'image
|
|
||||||
switch($infoImg[2])
|
|
||||||
{
|
|
||||||
case 1: // Gif
|
|
||||||
$trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On procéde autrement pour le format GIF
|
|
||||||
imagecolortransparent($imgThumb,$trans_colour);
|
|
||||||
break;
|
|
||||||
case 2: // Jpg
|
|
||||||
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
|
|
||||||
break;
|
|
||||||
case 3: // Png
|
|
||||||
imagealphablending($imgThumb,false); // Pour compatibilité sur certain systéme
|
|
||||||
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel
|
|
||||||
break;
|
|
||||||
case 4: // Bmp
|
|
||||||
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (function_exists("imagefill")) imagefill($imgThumb, 0, 0, $trans_colour);
|
|
||||||
|
|
||||||
dolibarr_syslog("vignette: convert image from ($imgWidth x $imgHeight) to ($thumbWidth x $thumbHeight) as $extImg, newquality=$newquality");
|
|
||||||
//imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insére l'image de base redimensionnée
|
|
||||||
imagecopyresampled($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Insére l'image de base redimensionnée
|
|
||||||
|
|
||||||
$fileName = eregi_replace('(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$','',$file); // On enleve extension quelquesoit la casse
|
|
||||||
$fileName = basename($fileName);
|
|
||||||
$imgThumbName = $dirthumb.$fileName.$extName.$extImg; // Chemin complet du fichier de la vignette
|
|
||||||
|
|
||||||
// Check if permission are ok
|
|
||||||
//$fp = fopen($imgThumbName, "w");
|
|
||||||
//fclose($fp);
|
|
||||||
|
|
||||||
// Create image on disk
|
|
||||||
switch($infoImg[2])
|
|
||||||
{
|
|
||||||
case 1: // Gif
|
|
||||||
imagegif($imgThumb, $imgThumbName);
|
|
||||||
break;
|
|
||||||
case 2: // Jpg
|
|
||||||
imagejpeg($imgThumb, $imgThumbName, $newquality);
|
|
||||||
break;
|
|
||||||
case 3: // Png
|
|
||||||
imagepng($imgThumb, $imgThumbName, $newquality);
|
|
||||||
break;
|
|
||||||
case 4: // Bmp
|
|
||||||
image2wmp($imgThumb, $imgThumbName);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Free memory
|
|
||||||
imagedestroy($imgThumb);
|
|
||||||
|
|
||||||
return $imgThumbName;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* \brief Converti les heures et minutes en secondes
|
* \brief Converti les heures et minutes en secondes
|
||||||
243
htdocs/lib/images.lib.php
Normal file
243
htdocs/lib/images.lib.php
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2004-2008 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) 2005-2007 Regis Houssin <regis@dolibarr.fr>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
* or see http://www.gnu.org/
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
\file htdocs/lib/images.lib.php
|
||||||
|
\brief Ensemble de fonctions de base de traitement d'images
|
||||||
|
\version $Id$
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* \brief Cr<43>ation de 2 vignettes a partir d'un fichier image (une small et un mini)
|
||||||
|
* \brief Les extension prise en compte sont jpg et png
|
||||||
|
* \param file Chemin du fichier image a redimensionner
|
||||||
|
* \param maxWidth Largeur maximum que dois faire la miniature (160 par d<>faut)
|
||||||
|
* \param maxHeight Hauteur maximum que dois faire l'image (120 par d<>faut)
|
||||||
|
* \param extName Extension pour diff<66>rencier le nom de la vignette
|
||||||
|
* \param quality Qualit<69> de compression (0=worst, 100=best)
|
||||||
|
* \return string Chemin de la vignette
|
||||||
|
*/
|
||||||
|
function vignette($file, $maxWidth = 160, $maxHeight = 120, $extName='_small', $quality=50)
|
||||||
|
{
|
||||||
|
global $langs;
|
||||||
|
|
||||||
|
dolibarr_syslog("functions.inc::vignette file=".$file." extName=".$extName." maxWidth=".$maxWidth." maxHeight=".$maxHeight." quality=".$quality);
|
||||||
|
|
||||||
|
// Nettoyage parametres
|
||||||
|
$file=trim($file);
|
||||||
|
|
||||||
|
// V<>rification des param<61>tres
|
||||||
|
if (! $file)
|
||||||
|
{
|
||||||
|
// Si le fichier n'a pas <20>t<EFBFBD> indiqu<71>
|
||||||
|
return 'Bad parameter file';
|
||||||
|
}
|
||||||
|
elseif (! file_exists($file))
|
||||||
|
{
|
||||||
|
// Si le fichier pass<73> en param<61>tre n'existe pas
|
||||||
|
return $langs->trans("ErrorFileNotFound",$file);
|
||||||
|
}
|
||||||
|
elseif(image_format_supported($file) < 0)
|
||||||
|
{
|
||||||
|
return 'This file '.$file.' does not seem to be an image format file name.';
|
||||||
|
}
|
||||||
|
elseif(!is_numeric($maxWidth) || empty($maxWidth) || $maxWidth < 0){
|
||||||
|
// Si la largeur max est incorrecte (n'est pas num<75>rique, est vide, ou est inf<6E>rieure a 0)
|
||||||
|
return 'Valeur de la largeur incorrecte.';
|
||||||
|
}
|
||||||
|
elseif(!is_numeric($maxHeight) || empty($maxHeight) || $maxHeight < 0){
|
||||||
|
// Si la hauteur max est incorrecte (n'est pas num<75>rique, est vide, ou est inf<6E>rieure a 0)
|
||||||
|
return 'Valeur de la hauteur incorrecte.';
|
||||||
|
}
|
||||||
|
|
||||||
|
$fichier = realpath($file); // Chemin canonique absolu de l'image
|
||||||
|
$dir = dirname($file).'/'; // Chemin du dossier contenant l'image
|
||||||
|
$dirthumb = $dir.'thumbs/'; // Chemin du dossier contenant les vignettes
|
||||||
|
|
||||||
|
$infoImg = getimagesize($fichier); // R<>cup<75>ration des infos de l'image
|
||||||
|
$imgWidth = $infoImg[0]; // Largeur de l'image
|
||||||
|
$imgHeight = $infoImg[1]; // Hauteur de l'image
|
||||||
|
|
||||||
|
// Si l'image est plus petite que la largeur et la hauteur max, on ne cr<63>e pas de vignette
|
||||||
|
if ($infoImg[0] < $maxWidth && $infoImg[1] < $maxHeight)
|
||||||
|
{
|
||||||
|
// On cree toujours les vignettes
|
||||||
|
dolibarr_syslog("File size is smaller than thumb size",LOG_DEBUG);
|
||||||
|
//return 'Le fichier '.$file.' ne n<>cessite pas de cr<63>ation de vignette';
|
||||||
|
}
|
||||||
|
|
||||||
|
$imgfonction='';
|
||||||
|
switch($infoImg[2])
|
||||||
|
{
|
||||||
|
case 1: // IMG_GIF
|
||||||
|
$imgfonction = 'imagecreatefromgif';
|
||||||
|
break;
|
||||||
|
case 2: // IMG_JPG
|
||||||
|
$imgfonction = 'imagecreatefromjpeg';
|
||||||
|
break;
|
||||||
|
case 3: // IMG_PNG
|
||||||
|
$imgfonction = 'imagecreatefrompng';
|
||||||
|
break;
|
||||||
|
case 4: // IMG_WBMP
|
||||||
|
$imgfonction = 'imagecreatefromwbmp';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if ($imgfonction)
|
||||||
|
{
|
||||||
|
if (! function_exists($imgfonction))
|
||||||
|
{
|
||||||
|
// Fonctions de conversion non presente dans ce PHP
|
||||||
|
return 'Creation de vignette impossible. Ce PHP ne supporte pas les fonctions du module GD '.$imgfonction;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// On cr<63>e le r<>pertoire contenant les vignettes
|
||||||
|
if (! file_exists($dirthumb))
|
||||||
|
{
|
||||||
|
create_exdir($dirthumb);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialisation des variables selon l'extension de l'image
|
||||||
|
switch($infoImg[2])
|
||||||
|
{
|
||||||
|
case 1: // Gif
|
||||||
|
$img = imagecreatefromgif($fichier);
|
||||||
|
$extImg = '.gif'; // Extension de l'image
|
||||||
|
$newquality='NU';
|
||||||
|
break;
|
||||||
|
case 2: // Jpg
|
||||||
|
$img = imagecreatefromjpeg($fichier);
|
||||||
|
$extImg = '.jpg'; // Extension de l'image
|
||||||
|
$newquality=$quality;
|
||||||
|
break;
|
||||||
|
case 3: // Png
|
||||||
|
$img = imagecreatefrompng($fichier);
|
||||||
|
$extImg = '.png';
|
||||||
|
$newquality=$quality-100;
|
||||||
|
$newquality=round(abs($quality-100)*9/100);
|
||||||
|
break;
|
||||||
|
case 4: // Bmp
|
||||||
|
$img = imagecreatefromwbmp($fichier);
|
||||||
|
$extImg = '.bmp';
|
||||||
|
$newquality='NU';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialisation des dimensions de la vignette si elles sont sup<75>rieures a l'original
|
||||||
|
if($maxWidth > $imgWidth){ $maxWidth = $imgWidth; }
|
||||||
|
if($maxHeight > $imgHeight){ $maxHeight = $imgHeight; }
|
||||||
|
|
||||||
|
$whFact = $maxWidth/$maxHeight; // Facteur largeur/hauteur des dimensions max de la vignette
|
||||||
|
$imgWhFact = $imgWidth/$imgHeight; // Facteur largeur/hauteur de l'original
|
||||||
|
|
||||||
|
// Fixe les dimensions de la vignette
|
||||||
|
if($whFact < $imgWhFact){
|
||||||
|
// Si largeur d<>terminante
|
||||||
|
$thumbWidth = $maxWidth;
|
||||||
|
$thumbHeight = $thumbWidth / $imgWhFact;
|
||||||
|
} else {
|
||||||
|
// Si hauteur d<>terminante
|
||||||
|
$thumbHeight = $maxHeight;
|
||||||
|
$thumbWidth = $thumbHeight * $imgWhFact;
|
||||||
|
}
|
||||||
|
$thumbHeight=round($thumbHeight);
|
||||||
|
$thumbWidth=round($thumbWidth);
|
||||||
|
|
||||||
|
// Create empty image
|
||||||
|
if ($infoImg[2] == 1)
|
||||||
|
{
|
||||||
|
// Compatibilit<69> image GIF
|
||||||
|
$imgThumb = imagecreate($thumbWidth, $thumbHeight);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$imgThumb = imagecreatetruecolor($thumbWidth, $thumbHeight);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Activate antialiasing for better quality
|
||||||
|
if (function_exists('imageantialias'))
|
||||||
|
{
|
||||||
|
imageantialias($imgThumb, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// This is to keep transparent alpha channel if exists (PHP >= 4.2)
|
||||||
|
if (function_exists('imagesavealpha'))
|
||||||
|
{
|
||||||
|
imagesavealpha($imgThumb, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialisation des variables selon l'extension de l'image
|
||||||
|
switch($infoImg[2])
|
||||||
|
{
|
||||||
|
case 1: // Gif
|
||||||
|
$trans_colour = imagecolorallocate($imgThumb, 255, 255, 255); // On proc<6F>de autrement pour le format GIF
|
||||||
|
imagecolortransparent($imgThumb,$trans_colour);
|
||||||
|
break;
|
||||||
|
case 2: // Jpg
|
||||||
|
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
|
||||||
|
break;
|
||||||
|
case 3: // Png
|
||||||
|
imagealphablending($imgThumb,false); // Pour compatibilit<69> sur certain syst<73>me
|
||||||
|
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 127); // Keep transparent channel
|
||||||
|
break;
|
||||||
|
case 4: // Bmp
|
||||||
|
$trans_colour = imagecolorallocatealpha($imgThumb, 255, 255, 255, 0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (function_exists("imagefill")) imagefill($imgThumb, 0, 0, $trans_colour);
|
||||||
|
|
||||||
|
dolibarr_syslog("vignette: convert image from ($imgWidth x $imgHeight) to ($thumbWidth x $thumbHeight) as $extImg, newquality=$newquality");
|
||||||
|
//imagecopyresized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Ins<6E>re l'image de base redimensionn<6E>e
|
||||||
|
imagecopyresampled($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight); // Ins<6E>re l'image de base redimensionn<6E>e
|
||||||
|
|
||||||
|
$fileName = eregi_replace('(\.gif|\.jpeg|\.jpg|\.png|\.bmp)$','',$file); // On enleve extension quelquesoit la casse
|
||||||
|
$fileName = basename($fileName);
|
||||||
|
$imgThumbName = $dirthumb.$fileName.$extName.$extImg; // Chemin complet du fichier de la vignette
|
||||||
|
|
||||||
|
// Check if permission are ok
|
||||||
|
//$fp = fopen($imgThumbName, "w");
|
||||||
|
//fclose($fp);
|
||||||
|
|
||||||
|
// Create image on disk
|
||||||
|
switch($infoImg[2])
|
||||||
|
{
|
||||||
|
case 1: // Gif
|
||||||
|
imagegif($imgThumb, $imgThumbName);
|
||||||
|
break;
|
||||||
|
case 2: // Jpg
|
||||||
|
imagejpeg($imgThumb, $imgThumbName, $newquality);
|
||||||
|
break;
|
||||||
|
case 3: // Png
|
||||||
|
imagepng($imgThumb, $imgThumbName, $newquality);
|
||||||
|
break;
|
||||||
|
case 4: // Bmp
|
||||||
|
image2wmp($imgThumb, $imgThumbName);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Free memory
|
||||||
|
imagedestroy($imgThumb);
|
||||||
|
|
||||||
|
return $imgThumbName;
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
@@ -28,7 +28,7 @@
|
|||||||
\version $Id$
|
\version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.inc.php');
|
require_once(DOL_DOCUMENT_ROOT.'/lib/functions.lib.php');
|
||||||
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
require_once(DOL_DOCUMENT_ROOT.'/includes/fpdf/fpdfi/fpdi_protection.php');
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ if (! empty($dolibarr_main_document_root_bis)) define('DOL_DOCUMENT_ROOT_BIS', $
|
|||||||
/*
|
/*
|
||||||
* Controle validite fichier conf
|
* Controle validite fichier conf
|
||||||
*/
|
*/
|
||||||
if (! file_exists(DOL_DOCUMENT_ROOT ."/lib/functions.inc.php"))
|
if (! file_exists(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php"))
|
||||||
{
|
{
|
||||||
print "Error: Dolibarr config file content seems to be not correctly defined.<br>\n";
|
print "Error: Dolibarr config file content seems to be not correctly defined.<br>\n";
|
||||||
print "Please run dolibarr setup by calling page <b>/install</b>.<br>\n";
|
print "Please run dolibarr setup by calling page <b>/install</b>.<br>\n";
|
||||||
@@ -109,7 +109,7 @@ if (! file_exists(DOL_DOCUMENT_ROOT ."/lib/functions.inc.php"))
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// on d<>code le mot de passe de la base si besoin
|
// on d<>code le mot de passe de la base si besoin
|
||||||
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.inc.php"); // Need 1.1Mo memory
|
require_once(DOL_DOCUMENT_ROOT ."/lib/functions.lib.php"); // Need 1.1 Mo memory
|
||||||
if (! empty($dolibarr_main_db_encrypted_pass)) $dolibarr_main_db_pass = dolibarr_decode($dolibarr_main_db_encrypted_pass);
|
if (! empty($dolibarr_main_db_encrypted_pass)) $dolibarr_main_db_pass = dolibarr_decode($dolibarr_main_db_encrypted_pass);
|
||||||
//stopwithmem();
|
//stopwithmem();
|
||||||
|
|
||||||
|
|||||||
@@ -2224,37 +2224,39 @@ class Product extends CommonObject
|
|||||||
{
|
{
|
||||||
$originImage = $dir . $file['name'];
|
$originImage = $dir . $file['name'];
|
||||||
|
|
||||||
// Cr<EFBFBD>e fichier en taille origine
|
// Cree fichier en taille origine
|
||||||
doliMoveFileUpload($file['tmp_name'], $originImage);
|
doliMoveFileUpload($file['tmp_name'], $originImage);
|
||||||
|
|
||||||
if (file_exists($originImage))
|
if (file_exists($originImage))
|
||||||
{
|
{
|
||||||
// Cr<EFBFBD>e fichier en taille vignette
|
// Cree fichier en taille vignette
|
||||||
$this->add_thumb($originImage,$maxWidth,$maxHeight);
|
$this->add_thumb($originImage,$maxWidth,$maxHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief G<EFBFBD>n<EFBFBD>re la vignette
|
* \brief Build thumb
|
||||||
* \param sdir R<EFBFBD>pertoire destination finale
|
* \param sdir Repertoire destination finale
|
||||||
* \param file Chemin du fichier d'origine
|
* \param file Chemin du fichier d'origine
|
||||||
* \param maxWidth Largeur maximum que dois faire la miniature (160 par d<EFBFBD>faut)
|
* \param maxWidth Largeur maximum que dois faire la miniature (160 par defaut)
|
||||||
* \param maxHeight Hauteur maximum que dois faire la miniature (120 par d<EFBFBD>faut)
|
* \param maxHeight Hauteur maximum que dois faire la miniature (120 par defaut)
|
||||||
*/
|
*/
|
||||||
function add_thumb($file, $maxWidth = 160, $maxHeight = 120)
|
function add_thumb($file, $maxWidth = 160, $maxHeight = 120)
|
||||||
{
|
{
|
||||||
if (file_exists($file))
|
require_once(DOL_DOCUMENT_ROOT ."/lib/images.lib.php");
|
||||||
{
|
|
||||||
vignette($file,$maxWidth,$maxHeight);
|
if (file_exists($file))
|
||||||
}
|
{
|
||||||
}
|
vignette($file,$maxWidth,$maxHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief D<EFBFBD>place fichier r<EFBFBD>cup<EFBFBD>r<EFBFBD> sur internet (utilis<EFBFBD> pour interface avec OSC)
|
* \brief Deplace fichier recupere sur internet (utilise pour interface avec OSC)
|
||||||
* \param sdir R<EFBFBD>pertoire destination finale
|
* \param sdir Repertoire destination finale
|
||||||
* \param $files url de l'image
|
* \param $files url de l'image
|
||||||
* Jean Heimburger juin 2007
|
* \author Jean Heimburger juin 2007
|
||||||
*/
|
*/
|
||||||
function add_photo_web($sdir, $files)
|
function add_photo_web($sdir, $files)
|
||||||
{
|
{
|
||||||
@@ -2269,10 +2271,10 @@ class Product extends CommonObject
|
|||||||
|
|
||||||
if (file_exists($dir))
|
if (file_exists($dir))
|
||||||
{
|
{
|
||||||
// Cr<EFBFBD>e fichier en taille vignette
|
// Cree fichier en taille vignette
|
||||||
// \todo A faire
|
// \todo A faire
|
||||||
|
|
||||||
// Cr<EFBFBD>e fichier en taille origine
|
// Cree fichier en taille origine
|
||||||
$content = file_get_contents($files);
|
$content = file_get_contents($files);
|
||||||
|
|
||||||
$nom = basename($files);
|
$nom = basename($files);
|
||||||
|
|||||||
Reference in New Issue
Block a user