greg Posted March 5, 2008 Share Posted March 5, 2008 I have the following function to delete the product’s images. I want to add the code to delete a hires image located in the folder /hires/ however I can’t get it work. The path for the hires images is www.mysite.com/hires/190.jpg where 190 is the product_id. Thanks function tep_remove_product($product_id) { $product_image_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . (int)$product_id . "'"); $product_image = tep_db_fetch_array($product_image_query); $duplicate_image_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_image = '" . tep_db_input($product_image['products_image']) . "'"); $duplicate_image = tep_db_fetch_array($duplicate_image_query); if ($duplicate_image['total'] < 2) { if (file_exists(DIR_FS_CATALOG_IMAGES . $product_image['products_image'])) { $LargeImage = substr($product_image['products_image'], 0, -4); $LargeImageExt = $LargeImage . '.' . 'jpg'; if (file_exists(DIR_FS_CATALOG_IMAGES . $LargeImageExt)) { @unlink(DIR_FS_CATALOG_IMAGES . $LargeImageExt); } @unlink(DIR_FS_CATALOG_IMAGES . $product_image['products_image']); } } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.