From e1a8fb9cebe5f4195bd03c0ad4db337a8ffdca56 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 4 Jul 2007 21:11:41 +0000 Subject: [PATCH] Ajout patch jean --- .../oscommerce_ws/ws_server/ws_articles.php | 5 +-- htdocs/product.class.php | 35 ++++++++++++++++++- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/htdocs/oscommerce_ws/ws_server/ws_articles.php b/htdocs/oscommerce_ws/ws_server/ws_articles.php index 3f226aace10..c81b8501651 100644 --- a/htdocs/oscommerce_ws/ws_server/ws_articles.php +++ b/htdocs/oscommerce_ws/ws_server/ws_articles.php @@ -27,8 +27,9 @@ require_once("./includes/configure.php"); define(OSC_IMG_URL, 'http://www.tiaris.info/catalog/images/'); // url du site OSC // OSC -define('OSCADMIN', '/home/jean/projets/osc_tiaris/admin/'); -define('OSCIMAGES', '/home/jean/projets/osc_tiaris/images/'); + +define('OSCADMIN', '/home/tiaris.info/catalog/admin/'); +define('OSCIMAGES', '/home/tiaris.info/catalog/images/'); require(OSCADMIN.'includes/configure.php'); require(OSCADMIN.DIR_WS_CLASSES . 'object_info.php'); diff --git a/htdocs/product.class.php b/htdocs/product.class.php index 916f333bd3e..2464000a09e 100644 --- a/htdocs/product.class.php +++ b/htdocs/product.class.php @@ -3,6 +3,7 @@ * Copyright (C) 2004-2007 Laurent Destailleur * Copyright (C) 2005-2007 Regis Houssin * Copyright (C) 2006 Andre Cianfarani + * Copyright (C) 2007 Jean Heimburger * * 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 @@ -2272,7 +2273,7 @@ class Product { $dir = $sdir .'/'. get_exdir($this->id,2) . $this->id ."/"; $dir .= "photos/"; - + if (! file_exists($dir)) { dolibarr_syslog("Product Create $dir"); @@ -2289,6 +2290,38 @@ class Product } } + /** + * \brief Déplace fichier récupéré sur internet (utilisé pour interface avec OSC) + * \param sdir Répertoire destination finale + * \param $files url de l'image + * Jean Heimburger juin 2007 + */ + function add_photo_web($sdir, $files) + { + $dir = $sdir .'/'. get_exdir($this->id,2) . $this->id ."/"; + $dir .= "photos/"; + + if (! file_exists($dir)) + { + dolibarr_syslog("Product Create $dir"); + create_exdir($dir); + } + + if (file_exists($dir)) + { + // Crée fichier en taille vignette + // \todo A faire + + // Crée fichier en taille origine + $content = file_get_contents($files); + + $nom = basename($files); + $im = fopen($dir.$nom,'wb'); + fwrite($im, $content); + fclose($im); +// } + } + } /** * \brief Affiche la première photo du produit