Version imprimable du sujet

Cliquez ici pour voir ce sujet dans son format original

Forum osCommerce-fr _ Contributions _ [Résolu] Contribution "création de répertoires"

Écrit par : Rockfell 31 Mar 2005, 10:54

Bonjour,

J'utilise la contribution "Categories & Products Images Folder Tree V1.2" (contrib. http://www.oscommerce.com/community/contributions,2409) pour créer des répertoires et sous répertoires pour mes images.

Le problème est le suivant : lorsque j'édite une fiche produit où l'image est déjà définie pour un article et que je remet à jour la fiche produit, le chemin du répertoire et sous-répertoire vers l'image se répète.

Par exemple : dvd/drame/image01.jpg devient dvd/drame/dvd/drame/image01.jpg, puis dvd/drame/dvd/drame/dvd/drame/image01.jpg, etc.

A chaque fois que je met à jour ma fiche produit j'ai donc plusieurs niveaux de répertoires qui se répètent.

Quelqu'un aurait-il le même problème avec cette contrib. ?

Merci.

-----------------------------------------------
OsCommerce V2.2 Ms2 (merci Delaballe)
-----------------------------------------------

Écrit par : Gnidhal 3 Apr 2005, 08:52

Doit y avoir un petit bug dans la récupération du nom de fichier.
Normalement dans la base il faut enregistrer le nom de fichier précédé de son chemin pour que l'image soit pointée correctement sur le serveur.

Dans le code de ta contrib tu dois donc trouver un truc du genre :

CODE
$image = $chemin_image . $image;

il faudrait alors tester si le chemin est déjà dans le nom de l'image avant de le rajouter systématiquement. ça pourrait donner un code à modifier du genre :
CODE
if (!ereg($chemin_image, $image)) $image = $chemin_image . $image;
ou encore
CODE
$image = (!ereg($chemin_image, $image)) ?  $chemin_image . $image : $image;

$image étant le nom de l'image : "image1.jpg"
$chemin_image étant le chemin d'accès à l'image : "/images/dvd/bidule/"

Voilà une piste de bug sur cette contribution. wink.gif
yapluka relever les manches smile.gif
Allez, Au Boulot ! wink.gif

Écrit par : Rockfell 3 Apr 2005, 09:22

Merci pour ta réponse Gnidhal.

Le code dont tu parles et qui pose problème se trouve peut-être dans admin/categories.php :

CODE

    case 'new_product_preview':
// copy image only if modified
      $products_image = new upload('products_image');
// images categories
      $prod_path = $HTTP_GET_VARS['cPath'];
      $lchar = strrpos($prod_path, '_');
if ($lchar + 1 == 1) {
      $lachar = 0;
      } else {
      $lachar = $lchar + 1;
      }
$prod_path_id = substr($prod_path, $lachar);
      $prod_folder = tep_output_generated_category_path_fs($prod_path_id);
      $products_image->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
// eof images categories
      if ($products_image->parse() && $products_image->save()) {


En résumé :
Quand on entre dans la partie "nouveau produit", on suppose que l'on doit uploader une image. En cliquant sur "aperçu" quand on édite le produit on voit bien l'image mais dès que l'on clique sur "mise à jour" le chemin de l'image est ajouté une nouvelle fois.

D'autres utilisateurs ont ce problème sur le forum US : http://forums.oscommerce.com/index.php?showtopic=110395&st=0&p=578353&#entry578353.

C'est bête sans ce problème cette contrib. serait vraiment bien. Les répertoires et sous-répertoires se créent automatiquement quand on upload une image (excepté quand le nom d'un répertoire contient un accent : ex. : le répertoire "comédie" sera créé en "comdie").

Dur, dur ... rolleyes.gif

Écrit par : osgadou 3 Apr 2005, 09:29

j'ai eu ce soucis et l'ai arrangé grace au forum us

j'ai cherché pour toi :
http://forums.oscommerce.com/index.php?showtopic=110110
bonne chance (voir page 2)!

Écrit par : Rockfell 3 Apr 2005, 20:33

Merci Osgadou, ça marche nickel !

Il y aurait même plusieurs façons de procéder.

J'ai retenu celle de "athyholdt" :

Dans admin/categories.php, trouver la ligne :

CODE

if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {
// images categories
$sql_data_array['products_image'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image']);
// eof images categories
}


et remplacer par :

CODE

if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none')) {

$product_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image'] != $HTTP_POST_VARS['products_image'])
{
// images categories
$sql_data_array['products_image'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image']);
// eof images categories
}
}



En fait, on vérifie si le chemin de l'image existe déjà dans la base de données, si "oui", ben ça ne rajoute pas le chemin une deuxième fois. (http://forums.oscommerce.com/index.php?showtopic=110110&st=20

Encore merci.

Écrit par : Mousticks 4 Apr 2005, 16:54

je viens d'essayer d'installer cette contrib mais des que je me rends dans l'admin il me stipule ceci :

QUOTE
Catégories / Produits   

1054 - Champ 'p.products_bimage' inconnu dans field list

select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_bimage, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from products p, products_description pd, products_to_categories p2c where p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = '0' order by pd.products_name

[TEP STOP]


je précise au cas ou que je n'ai pas vidé mes catégoriers et produits avant, je ne sais pas s'il fallait ? vu que j'ai déjà des trucs de rentré j'aurais préféré ne pas vider lol mais s'il faut... bah il faudra tongue.gif (à la rigueur jene suis qu'en test donc bon)

merci d'avance !! smile.gif

ps : j'ai préféré mettre mon prob dans un post déjà existant, ça pose pas de probleme ?

Écrit par : osgadou 5 Apr 2005, 12:28

la reponse est dans l'erreur :
p.products_bimage n'existe pas dans ta table products...

Mais ce products_bimage c'est pas de la contrib bigimage? est ce qu'il existe dans ta base? si oui est il ecrit exactement comme ca?

Écrit par : Mousticks 2 Jun 2005, 08:15

qd j'arrive a en résoudre 1 y'en a un autre qui rapplique biggrin.gif

j'ai donc fait les modif pour que lorsqu'on met a jour une fiche les chemins ne se répétent pas mais j'ai un petit soucis maintenant avec bimage unsure.gif

le code rajouté pour bimage est celui ci :

CODE
         if (isset($HTTP_POST_VARS['products_bimage']) && tep_not_null($HTTP_POST_VARS['products_bimage']) && ($HTTP_POST_VARS['products_bimage'] != 'none')) {
           $sql_data_array['products_bimage'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_bimage']);
         }


donc je pensais bah tout simplement faire comme la correction proposées et mettre ce code la :
CODE
if (isset($HTTP_POST_VARS['products_bimage']) && tep_not_null($HTTP_POST_VARS['products_bimage']) && ($HTTP_POST_VARS['products_bimage'] != 'none')) {

$product_query = tep_db_query("select products_bimage from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_bimage'] != $HTTP_POST_VARS['products_bimage'])
{
// images categories
$sql_data_array['products_bimage'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_bimage']);
// eof images categories
}
}


mais ça ne change rien confused.gif si qq'un a une piste ou le moyen de m'aider la dessus smile.gif

marchiiii tongue.gif

Écrit par : osgadou 3 Jun 2005, 13:41

si je me souviens bien,
il y a un soucis d'interference entre big image et folder tree....
j'avais eu le même pb, jai laissé tombé big image, et je me suis fait un big image "maison"...

>Creation dans l'admin d'un nouveau champs pour le produit dans lequel je rajoute mon fichier grosse image
>modification de la requete de la popup pour qu'elle recupere mon nouveau champs

il faut s'y connaitre un petit peu voila..

Écrit par : Mousticks 11 Jun 2005, 08:07

arfff c chiant ça lol
merci pour l'info, pu ka trouver une solution alors, parce que faire un big image moi m je doute fortement y arriver confused.gif

Écrit par : ladiag 19 Aug 2008, 10:50

Salut à tous,

Je me permets de déterrer ce post d'outre-tombe pour vous dire que j'ai réussi à adapter cette contribution avec la contribution Ultra Pics 2.08 + Lightbox donc si certains essayent de le faire mais n'y arrivent pas, je pourrais les renseigner.

J'ai un peu la flemme tongue.gif de le poster si personne ne me dit que ca peut lui servir puisqu'il y a pas mal de retouches à faire mais je le ferais si ne serait-ce qu'une personne est intéressée.

Cordialement

Écrit par : nephelion 19 Aug 2008, 11:54

si tu veux bien , je suis demandeur !
merci ladiag

Écrit par : ladiag 19 Aug 2008, 13:05

En attendant d'en faire un fichier téléchargeable, je l'ai envoyé par mp à nephelion. Le problème est que mon categories.php est plein d'autres contrib alors il faut que je fasse le tri pour savoir ce que les gens doivent mettre. D'ici là, je peux l'envoyer par mp à ceux qui souhaitent.

Écrit par : ladiag 20 Aug 2008, 19:58

Salut à tous,

Alors voilà comment j'ai fait pour adapter Ultra Images avec Categories Tree Builder, je ne suis pas un expert de PHP, donc je ne sais pas si c'est un bon codage mais en tout cas ca marche pour moi. Supposons que vous ayez déjà installé UltraPics et que vous avez installé Categories Tree Builder et que vous voulez maintenant l'adapter aux images supplémentaires, lorsque vous modifiez le fichier categories.php situé dans votre admin...

... Remplacez (ligne 329 pour moi) :

Code
// BOF MaxiDVD: Modified For Ultimate Images Pack!
   if (($HTTP_POST_VARS['unlink_image'] == 'yes') or ($HTTP_POST_VARS['delete_image'] == 'yes')) {
             $sql_data_array['products_image'] = '';
           } else

if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none'))
{

$product_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image'] != $HTTP_POST_VARS['products_image'])
{
// images categories
$sql_data_array['products_image'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image']);
// eof images categories
}
}


... par ...

Code
// BOF MaxiDVD: Modified For Ultimate Images Pack!
     //   if (($HTTP_POST_VARS['unlink_image'] == 'yes') or ($HTTP_POST_VARS['delete_image'] == 'yes')) {
    //         $sql_data_array['products_image'] = '';
      //      } else

if (isset($HTTP_POST_VARS['products_image']) && tep_not_null($HTTP_POST_VARS['products_image']) && ($HTTP_POST_VARS['products_image'] != 'none'))
{

$product_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image'] != $HTTP_POST_VARS['products_image'])
{
// images categories
$sql_data_array['products_image'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image']);
// eof images categories
}
}
if (isset($HTTP_POST_VARS['products_image_sm_1']) && tep_not_null($HTTP_POST_VARS['products_image_sm_1']) && ($HTTP_POST_VARS['products_image_sm_1'] != 'none'))
{
$product_query = tep_db_query("select products_image_sm_1 from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image_sm_1'] != $HTTP_POST_VARS['products_image_sm_1'])
{
// images categories
$sql_data_array['products_image_sm_1'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_1']);
// eof images categories
}
}
if (isset($HTTP_POST_VARS['products_image_xl_1']) && tep_not_null($HTTP_POST_VARS['products_image_xl_1']) && ($HTTP_POST_VARS['products_image_xl_1'] != 'none'))
{
$product_query = tep_db_query("select products_image_xl_1 from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image_xl_1'] != $HTTP_POST_VARS['products_image_xl_1'])
{
// images categories
$sql_data_array['products_image_xl_1'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_1']);
// eof images categories
}
}
if (isset($HTTP_POST_VARS['products_image_sm_2']) && tep_not_null($HTTP_POST_VARS['products_image_sm_2']) && ($HTTP_POST_VARS['products_image_sm_2'] != 'none'))
{
$product_query = tep_db_query("select products_image_sm_2 from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image_sm_2'] != $HTTP_POST_VARS['products_image_sm_2'])
{
// images categories
$sql_data_array['products_image_sm_2'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_2']);
// eof images categories
}
}
if (isset($HTTP_POST_VARS['products_image_xl_2']) && tep_not_null($HTTP_POST_VARS['products_image_xl_2']) && ($HTTP_POST_VARS['products_image_xl_2'] != 'none'))
{
$product_query = tep_db_query("select products_image_xl_2 from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image_xl_2'] != $HTTP_POST_VARS['products_image_xl_2'])
{
// images categories
$sql_data_array['products_image_xl_2'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_2']);
// eof images categories
}
}
if (isset($HTTP_POST_VARS['products_image_sm_3']) && tep_not_null($HTTP_POST_VARS['products_image_sm_3']) && ($HTTP_POST_VARS['products_image_sm_3'] != 'none'))
{
$product_query = tep_db_query("select products_image_sm_3 from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image_sm_3'] != $HTTP_POST_VARS['products_image_sm_3'])
{
// images categories
$sql_data_array['products_image_sm_3'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_3']);
// eof images categories
}
}
if (isset($HTTP_POST_VARS['products_image_xl_3']) && tep_not_null($HTTP_POST_VARS['products_image_xl_3']) && ($HTTP_POST_VARS['products_image_xl_3'] != 'none'))
{
$product_query = tep_db_query("select products_image_xl_3 from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image_xl_3'] != $HTTP_POST_VARS['products_image_xl_3'])
{
// images categories
$sql_data_array['products_image_xl_3'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_3']);
// eof images categories
}
}
if (isset($HTTP_POST_VARS['products_image_sm_4']) && tep_not_null($HTTP_POST_VARS['products_image_sm_4']) && ($HTTP_POST_VARS['products_image_sm_4'] != 'none'))
{
$product_query = tep_db_query("select products_image_sm_4 from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image_sm_4'] != $HTTP_POST_VARS['products_image_sm_4'])
{
// images categories
$sql_data_array['products_image_sm_4'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_4']);
// eof images categories
}
}
if (isset($HTTP_POST_VARS['products_image_xl_4']) && tep_not_null($HTTP_POST_VARS['products_image_xl_4']) && ($HTTP_POST_VARS['products_image_xl_4'] != 'none'))
{
$product_query = tep_db_query("select products_image_xl_4 from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image_xl_4'] != $HTTP_POST_VARS['products_image_xl_4'])
{
// images categories
$sql_data_array['products_image_xl_4'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_4']);
// eof images categories
}
}
if (isset($HTTP_POST_VARS['products_image_sm_5']) && tep_not_null($HTTP_POST_VARS['products_image_sm_5']) && ($HTTP_POST_VARS['products_image_sm_5'] != 'none'))
{
$product_query = tep_db_query("select products_image_sm_5 from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image_sm_5'] != $HTTP_POST_VARS['products_image_sm_5'])
{
// images categories
$sql_data_array['products_image_sm_5'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_5']);
// eof images categories
}
}
if (isset($HTTP_POST_VARS['products_image_xl_5']) && tep_not_null($HTTP_POST_VARS['products_image_xl_5']) && ($HTTP_POST_VARS['products_image_xl_5'] != 'none'))
{
$product_query = tep_db_query("select products_image_xl_5 from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image_xl_5'] != $HTTP_POST_VARS['products_image_xl_5'])
{
// images categories
$sql_data_array['products_image_xl_5'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_5']);
// eof images categories
}
}
if (isset($HTTP_POST_VARS['products_image_sm_6']) && tep_not_null($HTTP_POST_VARS['products_image_sm_6']) && ($HTTP_POST_VARS['products_image_sm_6'] != 'none'))
{
$product_query = tep_db_query("select products_image_sm_6 from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image_sm_6'] != $HTTP_POST_VARS['products_image_sm_6'])
{
// images categories
$sql_data_array['products_image_sm_6'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image_sm_6']);
// eof images categories
}
}
if (isset($HTTP_POST_VARS['products_image_xl_6']) && tep_not_null($HTTP_POST_VARS['products_image_xl_6']) && ($HTTP_POST_VARS['products_image_xl_6'] != 'none'))
{
$product_query = tep_db_query("select products_image_xl_6 from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
$product = tep_db_fetch_array($product_query);
// Check if image path is already in the DB
if ($product['products_image_xl_6'] != $HTTP_POST_VARS['products_image_xl_6'])
{
// images categories
$sql_data_array['products_image_xl_6'] = tep_output_generated_category_path_fs($current_category_id) . tep_db_prepare_input($HTTP_POST_VARS['products_image_xl_6']);
// eof images categories
}
}


... et remplacez ...

Code
      case 'new_product_preview':
// copy image only if modified
        $products_image = new upload('products_image');
// images categories
        $prod_path = $HTTP_GET_VARS['cPath'];
        $lchar = strrpos($prod_path, '_');
        if ($lchar + 1 == 1) {
        $lachar = 0;
        } else {
        $lachar = $lchar + 1;
        }
        $prod_path_id = substr($prod_path, $lachar);
        $prod_folder = tep_output_generated_category_path_fs($prod_path_id);
        $products_image->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
// eof images categories
        if ($products_image->parse() && $products_image->save()) {
          $products_image_name =$products_image->filename;
        } else {
          $products_image_name = $HTTP_POST_VARS['products_previous_image'];
        }
       break;


... par ...

Code
      case 'new_product_preview':
// copy image only if modified
        $products_image = new upload('products_image');
// images categories
        $prod_path = $HTTP_GET_VARS['cPath'];
        $lchar = strrpos($prod_path, '_');
        if ($lchar + 1 == 1) {
        $lachar = 0;
        } else {
        $lachar = $lchar + 1;
        }
        $prod_path_id = substr($prod_path, $lachar);
        $prod_folder = tep_output_generated_category_path_fs($prod_path_id);
        $products_image->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
// eof images categories
        if ($products_image->parse() && $products_image->save()) {
          $products_image_name =$products_image->filename;
        } else {
          $products_image_name = $HTTP_POST_VARS['products_previous_image'];
        }
// copy image_med  only if modified
$products_image_med = new upload('products_image_med');
$products_image_med->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
if ($products_image_med->parse() && $products_image_med->save()) {
$products_image_med_name = $products_image_med->filename;
} else {
$products_image_med_name = $HTTP_POST_VARS['products_previous_image_med'];
}
// copy image_lrg  only if modified
$products_image_lrg = new upload('products_image_lrg');
$products_image_lrg->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
if ($products_image_lrg->parse() && $products_image_lrg->save()) {
$products_image_lrg_name = $products_image_lrg->filename;
} else {
$products_image_lrg_name = $HTTP_POST_VARS['products_previous_image_lrg'];
}

// copy image_sm_1  only if modified
$products_image_sm_1 = new upload('products_image_sm_1');
$products_image_sm_1->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
if ($products_image_sm_1->parse() && $products_image_sm_1->save()) {
$products_image_sm_1_name = $products_image_sm_1->filename;
} else {
$products_image_sm_1_name = $HTTP_POST_VARS['products_previous_image_sm_1'];
}
// copy image_xl_1  only if modified
$products_image_xl_1 = new upload('products_image_xl_1');
$products_image_xl_1->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
if ($products_image_xl_1->parse() && $products_image_xl_1->save()) {
$products_image_xl_1_name = $products_image_xl_1->filename;
} else {
$products_image_xl_1_name = $HTTP_POST_VARS['products_previous_image_xl_1'];
}
// copy image_sm_2  only if modified
$products_image_sm_2 = new upload('products_image_sm_2');
$products_image_sm_2->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
if ($products_image_sm_2->parse() && $products_image_sm_2->save()) {
$products_image_sm_2_name = $products_image_sm_2->filename;
} else {
$products_image_sm_2_name = $HTTP_POST_VARS['products_previous_image_sm_2'];
}
// copy image_xl_2  only if modified
$products_image_xl_2 = new upload('products_image_xl_2');
$products_image_xl_2->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
if ($products_image_xl_2->parse() && $products_image_xl_2->save()) {
$products_image_xl_2_name = $products_image_xl_2->filename;
} else {
$products_image_xl_2_name = $HTTP_POST_VARS['products_previous_image_xl_2'];
}
// copy image_sm_3  only if modified
$products_image_sm_3 = new upload('products_image_sm_3');
$products_image_sm_3->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
if ($products_image_sm_3->parse() && $products_image_sm_3->save()) {
$products_image_sm_3_name = $products_image_sm_3->filename;
} else {
$products_image_sm_3_name = $HTTP_POST_VARS['products_previous_image_sm_3'];
}
// copy image_xl_3  only if modified
$products_image_xl_3 = new upload('products_image_xl_3');
$products_image_xl_3->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
if ($products_image_xl_3->parse() && $products_image_xl_3->save()) {
$products_image_xl_3_name = $products_image_xl_3->filename;
} else {
$products_image_xl_3_name = $HTTP_POST_VARS['products_previous_image_xl_3'];
}
// copy image_sm_4  only if modified
$products_image_sm_4 = new upload('products_image_sm_4');
$products_image_sm_4->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
if ($products_image_sm_4->parse() && $products_image_sm_4->save()) {
$products_image_sm_4_name = $products_image_sm_4->filename;
} else {
$products_image_sm_4_name = $HTTP_POST_VARS['products_previous_image_sm_4'];
}
// copy image_xl_4  only if modified
$products_image_xl_4 = new upload('products_image_xl_4');
$products_image_xl_4->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
if ($products_image_xl_4->parse() && $products_image_xl_4->save()) {
$products_image_xl_4_name = $products_image_xl_4->filename;
} else {
$products_image_xl_4_name = $HTTP_POST_VARS['products_previous_image_xl_4'];
}
// copy image_sm_5  only if modified
$products_image_sm_5 = new upload('products_image_sm_5');
$products_image_sm_5->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
if ($products_image_sm_5->parse() && $products_image_sm_5->save()) {
$products_image_sm_5_name = $products_image_sm_5->filename;
} else {
$products_image_sm_5_name = $HTTP_POST_VARS['products_previous_image_sm_5'];
}
// copy image_xl_5  only if modified
$products_image_xl_5 = new upload('products_image_xl_5');
$products_image_xl_5->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
if ($products_image_xl_5->parse() && $products_image_xl_5->save()) {
$products_image_xl_5_name = $products_image_xl_5->filename;
} else {
$products_image_xl_5_name = $HTTP_POST_VARS['products_previous_image_xl_5'];
}
// copy image_sm_6  only if modified
$products_image_sm_6 = new upload('products_image_sm_6');
$products_image_sm_6->set_destination(DIR_FS_CATALOG_IMAGES . $prod_folder);
if ($products_image_sm_6->parse() && $products_image_sm_6->save()) {
$products_image_sm_6_name = $products_image_sm_6->filename;
} else {
$products_image_sm_6_name = $HTTP_POST_VARS['products_previous_image_sm_6'];
}
// copy image_xl_6  only if modified
$products_image_xl_6 = new upload('products_image_xl_6');
$products_image_xl_6->set_destination(DIR_FS_CATALOG_IMAGES);
if ($products_image_xl_6->parse() && $products_image_xl_6->save()) {
$products_image_xl_6_name = $products_image_xl_6->filename;
} else {
$products_image_xl_6_name = $HTTP_POST_VARS['products_previous_image_xl_6'];
}
break;


Je suis disponible pour (essayer de) répondre aux questions des uns et des autres...

Bonne soirée !

Propulsé par Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)