nice suggestion, but it is the opposite of what this cron does, I don't want to delete unused images from my server, I want to find out which products do not have an image assigned to them
nice suggestion, but it is the opposite of what this cron does, I don't want to delete unused images from my server, I want to find out which products do not have an image assigned to them
Try this instead:
Paste the following code into a new file (find_missing_images.php) in the root of your store (same folder as ipn_main_handler.php):And then access it via your browser: www.example.com/find_missing_images.phpCode:<?php $_SERVER['REMOTE_ADDR'] = 'cron'; $result = require('includes/application_top.php'); if ($result == FALSE) die("Error: application_top not found.\nCannot proceed.\n\n"); $result = $db->Execute( "SELECT products_id, products_status, products_image FROM " . TABLE_PRODUCTS . " ORDER BY products_image" ); $missing = array (); while (!$result->EOF) { if (!file_exists(DIR_WS_IMAGES . $result->fields['products_image'])) $missing[] = $result->fields['products_image']; $result->MoveNext(); } if (sizeof($missing)) { echo '<p>Missing images identified:</p>' . "\n"; foreach($missing as $val) { echo $val . "<br>\n"; } } else { echo '<p>No missing images identified.</p>'; }
.
Zen Cart - putting the dream of business ownership within reach of anyone!
Donate to: DrByte directly or to the Zen Cart team as a whole
Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.
works well, thanks for this
now to challenge you even more - is there a add on where the products listed on my cart, which have the missing images, can be remoled in bulk?
I tried the code listed.
I have about 800 items and only about 20 have an image so for, New Store I'm just setting up.
I got a message "No missing images identified." and I guess that is because the products do not yet have an image specified.
Is there a similar easy way to find what items do not yet have a picture? I have about 2,000 items to do total eventually.
Also how do I bulk upload my images and get the products to find them. I am sure I am missing something easy?
At this time I am trying to go through 1 item at a time and enter the image. Images have the same name as item number. So if myproduct123 is the item number then the image is myproduct123_400.jpg
I have read that if I used a base name such as myproduct.jpg Zencart would use all images of that base such as myproduct123_400.jpg and myproduct123_400BK.jpg etc.. for extra images, but that is not working either for me right now. I use myproduct123.jpg and the image is not shown, it is only shown when I use the full name myproduct123_400.jpg
I can bulk upload all the images into /images but do I really have to go through each item one at a time in category/products to add them?
Thanks