This is a discussion on change default image directories within the New osCommerce Contributions forums, part of the osCommerce 2.2 Forums category; this: // copy image only if modified $cid = explode('_', $cPath); foreach($cid as $key => $value){ $cdat = tep_db_query("SELECT categories_name ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| ||||
| ||||
| this: // copy image only if modified $cid = explode('_', $cPath); foreach($cid as $key => $value){ $cdat = tep_db_query("SELECT categories_name FROM categories_description WHERE categories_id = '" . $value . "' && language_id = '1'"); $cat = tep_db_fetch_array($cdat); $categoryfile .= $cat[categories_name] . "/"; $_SESSION['categoryfile'] = $categoryfile; } $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile); if ($products_image->parse() && $products_image->save()) { $products_image_name = DIR_FS_PRODUCTS_IMAGES . $categoryfile . $products_image->filename; } else { ------------------------------------------------- replace with: // copy image only if modified $cid = explode('_', $cPath); foreach($cid as $key => $value){ $cdat = tep_db_query("SELECT categories_name FROM categories_description WHERE categories_id = '" . $value . "' && language_id = '1'"); $cat = tep_db_fetch_array($cdat);if ($cat[categories_name] == !null){ $categoryfile .= $cat[categories_name] . "/";} if (file_exists(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile)==false) {$str = DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile . $subcfile ; mk_dir($str); }; $_SESSION['categoryfile'] = $categoryfile; } $products_image = new upload('products_image'); $products_image->set_destination(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile); if ($products_image->parse() && $products_image->save()) { $products_image_name = DIR_FS_PRODUCTS_IMAGES . $categoryfile . $products_image->filename; } else { ///////////////////////////////////////////////////////////// and this: // check if the catalog image directory exists if (is_dir(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile . $subcfile)) { if (!is_writeable(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile . $subcfile)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE , 'error'); } else { $messageStack->add(ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_DOES_NO T_EXIST, 'error'); unset($_SESSION['categoryfile']); } ------------------------------------------------ replace with: if (is_dir(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile . $subcfile)) { if (!is_writeable(DIR_FS_CATALOG_IMAGES . DIR_FS_PRODUCTS_IMAGES . $categoryfile . $subcfile)) $messageStack->add(ERROR_CATALOG_IMAGE_DIRECTORY_NOT_WRITEABLE , 'error'); } else { $messageStack->add(ERROR_CATALOG_PRODUCT_IMAGE_DIRECTORY_DOES_NO T_EXIST, 'error'); } function mk_dir($str, $mode=0777) { if(!(is_dir($str) || @mkdir($str, $mode))) { mk_dir(dirname($str)); mk_dir($str); } } unset($_SESSION['categoryfile']); //////////////////////////////////////////////////////// make these changes, then the categories directoires will be aoto build in products directories and products pics will be into their categoies directories. that's easy to manager all products pisc ! thanks, if have any problem, content me with simomchen41@gmail.com More...
__________________ Michael Sasek osCMax Developer
|
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| change default image directories | michael_s | New osCommerce Contributions | 0 | 06-03-2007 04:02 PM |
| change default image directories | michael_s | New osCommerce Contributions | 0 | 06-02-2007 05:15 AM |
| change default image directories | michael_s | New osCommerce Contributions | 0 | 05-31-2007 03:21 PM |
| change default image directories | michael_s | New osCommerce Contributions | 0 | 05-08-2007 06:10 AM |
| change default image directories | michael_s | New osCommerce Contributions | 0 | 05-07-2007 03:11 PM |