Guest Posted May 16, 2003 Posted May 16, 2003 Hi all, Reference the Big Images Mod', Please can anyone tell me if there is a way to automatically delete a Big Image (popup) at the time you delete a product in the admin? I know the default image (thumbnail type) is removed, but the Big image stays in the directory and has to be deleted manually. I am planning on setting my site up so that many products(and images) are added and deleted on a daily basis, so this would be very beneficial in time saving! If it's not possible, is there any other applicable mod that might do the job. I've checked Mo-Pics that seems to do the deleting ok, but I don't want multiple images of the same product, just a thumbnail and a seperate enlarged popup image. Any help would be appreciated. Thanks in advance. Adam Quote
slackbladder Posted May 16, 2003 Posted May 16, 2003 Hi Adam, OK figured it out! :D I also use the 'Big Images' mod - so its a help to me too although my turnaround in images isnt too big! In /admin/functions/general.php, look for this: function tep_remove_product($product_id) { $product_image_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . tep_db_input($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'])) { @unlink(DIR_FS_CATALOG_IMAGES . $product_image['products_image']); } } And replace it with this: function tep_remove_product($product_id) { $product_image_query = tep_db_query("select products_image from " . TABLE_PRODUCTS . " where products_id = '" . tep_db_input($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'])) { @unlink(DIR_FS_CATALOG_IMAGES . $product_image['products_image']); } } $product_bimage_query = tep_db_query("select products_bimage from " . TABLE_PRODUCTS . " where products_id = '" . tep_db_input($product_id) . "'"); $product_image = tep_db_fetch_array($product_bimage_query); $duplicate_bimage_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " where products_bimage = '" . tep_db_input($product_image['products_bimage']) . "'"); $duplicate_image = tep_db_fetch_array($duplicate_bimage_query); if ($duplicate_bimage['total'] < 2) { if (file_exists(DIR_FS_CATALOG_IMAGES . $product_image['products_bimage'])) { @unlink(DIR_FS_CATALOG_IMAGES . $product_image['products_bimage']); } } I haven't tested it fully, so BACKUP!!!!! Let me know how you get on. Cheers Tony Quote
slackbladder Posted May 16, 2003 Posted May 16, 2003 :oops: Sorry - general.php is in /admin/includes/functions/general.php Quote
Guest Posted May 17, 2003 Posted May 17, 2003 Hi Tony, You have solved it for me! :D It appears to be working perfectly from the short test I have done. Thanks very much, I'm sure this will help a lot of people who use the Big Image add-on. Thanks again and all the best! Adam Quote
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.
Note: Your post will require moderator approval before it will be visible.