Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2011
    Location
    guernsey , uk
    Posts
    39
    Plugin Contributions
    0

    Idea or Suggestion filtering out missing images

    my website is quite large, and I have a backup of all csv and image files on my computer

    as I have over 100,000 products and my intention is to filter the list onto separate website so that each site carries a different category

    my problem comes when I upload the csv files, and the images, some of the images seem to be missing, but to go through 100,000 product lines would be a nightmare.

    I had a good excel programmer friend help me out one time, with the following batch file, which was of enormous help, and probably will be for anyone else wanting to filter out images from a huge folder, based on those inside a text file

    is there anyone who can take this a step further, and have the batch file dump a list of the filenames it was not able to find, into a separate file?

    batch.bat file is
    Code:
    @echo off & setlocal
    :: assuming this is where they are, if not, adjust as needed:
    set location=C:\Users\Windows7\Desktop\iwantafiles\fullcsvfiles\categories\mobiles\images
    for /f "tokens=*" %%a in (%location%\imagelist.txt) do (
    copy "%location%\%%a" c:\imagelist
    )
    ::end batchscript

  2. #2
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: filtering out missing images

    .

    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.

  3. #3
    Join Date
    Mar 2011
    Location
    guernsey , uk
    Posts
    39
    Plugin Contributions
    0

    Default Re: filtering out missing images

    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

  4. #4
    Join Date
    Jan 2004
    Posts
    66,364
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: filtering out missing images

    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):
    Code:
    <?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>';
    }
    And then access it via your browser: www.example.com/find_missing_images.php
    .

    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.

  5. #5
    Join Date
    Mar 2011
    Location
    guernsey , uk
    Posts
    39
    Plugin Contributions
    0

    Default Re: filtering out missing images

    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?

  6. #6

    Default Re: filtering out missing images

    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

 

 

Similar Threads

  1. Out of Stock pirce missing
    By billett in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 14 Sep 2009, 09:38 PM
  2. Magic SEO missing out pages
    By Just a beginner in forum All Other Contributions/Addons
    Replies: 6
    Last Post: 19 Aug 2009, 05:11 PM
  3. Changing Shopping Cart images and filtering products
    By bugstumper in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 4 Aug 2008, 01:54 PM
  4. 1.3.6 missing check out without account
    By usernamenone in forum Upgrading from 1.3.x to 1.3.9
    Replies: 2
    Last Post: 17 Nov 2006, 12:07 PM
  5. product listing 'sold out' image is missing!
    By notrub225 in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 22 Sep 2006, 02:04 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR