It appears that when ISC makes a backup of the "product_images" directory, it copies ONLY the images that are associated with an product that's in the "isc_products" table. ~~ In other words: any "dead" or unused images in the "product_images" directory are not included in the backup.
After I discovered this... it occurred to me that the backup copy of "product_images" could be moved to the store's root directory (ie: as "product_images_new") and then quickly rename "product_images" to "product_images_bloated" ... then rename "product_images_new" to "product_images".
This works!! ~~ But with a few caveats! Take note!!!
1) The backup copy of "product_images" contains ONLY the active product images.
2) The code that creates the backup copy of "product_images" DOES NOT COPY THE FOLLOWING:
-- a) the category icons
-- b) the category default image (if you use something other than the default)
-- c) the store logo (if you've uploaded an image via the admin interface)
-- d) the "uploaded_images" directory.
-- e) the "wrap_images" directory.
-- f) the "configured_products" directory.
As a result of the MISSING ITEMS, my idea of replacing the bloated "product_images" with the backup "product_images" was a bit of failure.
The products displayed fine... but my store logo was missing and my category icons were missing.
It was simple enough to copy the missing directories into the new version of "product_images"... and I easily copied my store logo into the new directory as well. ~~ The biggest problem was the category icons!
Sometimes the ISC coding really impresses me... but other times, the short-sighted and LAZY programming just baffles me!! ~~ WHY ON EARTH would they not include the category icon images as part of the "product_images" backup?!!
They're IN the "product_images" directory already (scattered randomly through the "a-z" subdirectories) so they should also be included! Right?
MY SHORT TERM SOLUTION FOLLOWS...
For some people this may not be practical, but here's what I did.
1) I created a sub-directory in "product_images" called "caticons".
2) I peeked at the "categories" table and looked at the entries in the "catimagefile" field (this contains the filename and subdirectory name for every category icon.)
3) I cut-and-pasted the filenames into a text document for easy reading.
4) I copied all 150+ category icons into my new "caticons" sub-directory (one by one... painful)
Now... all my caticons are in ONE directory. ISC's backup script STILL won't include them during a backup... but at least I know they're ALL in the same place, and I can manually copy them when needed.
5) I made a backup copy of the "categories" table.
6) I edited the contents of the "catimagefile" fields and removed the "a-z" subdirectories... and changed it to "caticons".
For example:
a/computers_icon.gif
b/tires_icon.gif
c/mobile_icon.gif
...
z/printers_icon.jpg
became
caticons/computers_icon.gif
caticons/tires_icon.gif
caticons/mobile_icon.gif
...
caticons/printers_icon.jpg
THIS WORKED!!
NEXT... I knew that if I added any new category icons, they would ALSO be scattered randomly through the a-z subdirectories. So a quick modification to the PHP script was needed.
In the file: admin\includes\classes\class.category.php (around line 930) is the following code:
Code: Select all
// Determine the destination directory
$randomDir = strtolower(chr(rand(65, 90)));
Code: Select all
// Determine the destination directory
// $randomDir = strtolower(chr(rand(65, 90)));
$randomDir = "caticon";
FOR NOW, I have two "product_images" directories in my store. ~ The old bloated one still exists as "product_images_bloated" until I'm convinced that my new version is working without any other problems.
In my next post... I'll talk about some ideas that are relatively easy for me to conceptualize... but that are far beyond my programming skills.