Loaded Commerce Community

Banner


Board index » Loaded Commerce Support » Tips & Tricks

All times are UTC - 5 hours




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: SiteTool: Check for missing product images?
PostPosted: Sun Sep 17, 2006 9:23 pm 
Offline
CRE Talented
User avatar

Joined: Mon Jan 09, 2006 1:00 am
Posts: 333
If you have thousands of images and are tired of checking them manually, here is a script I run to check for missing images of items on the product listing pages and the product info pages.

Has your site been hacked or has the server been down? Concerned about your site being corrupted, this script will do what you do when you check to see if the site looks ok, but more accurately and in seconds.

The script will check to see what images you have listed for your items and then it will check to see if they really exist. Saves bandwidth and alot of time!

Just copy and save as missing_images_check.php, place in the shop root and run.

Code:
<?php
// missing_images_check.php vers 1.0 by pyramids 09172006
// For product info and product listing pages

$hold_miss_pic = 0;// base for missing pics
$hold_miss_pic_list = '';// hold the list of missing pics
$hold_status = 1;// for active items set to 1, otherwise set to 0

if (!file_exists('includes/configure.php')) {echo "<font size=4>Can't find the <b>'includes/configure.php'</b> file.   <b>NOTE: </b>This script 'missing_images_check.php' needs to run in the shop root</font>";die();}

require ('includes/configure.php');// login info

$conn = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die(mysql_error());// connect to db

$select_db = mysql_select_db(DB_DATABASE, $conn) or die(mysql_error());//select the right db

   $sql = "select p.products_image as products_image, p.products_image_med as products_image_med, p.products_model as products_model from products p where p.products_status = '" . $hold_status . "'";
   $result = mysql_query($sql, $conn) or die(mysql_error());

//run through every product with the status of "on" (default) check to see if the images exists
while ($get_data = mysql_fetch_array($result)){

if (!file_exists('images/' . $get_data['products_image_med'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing<font color="Red"><b>' . $get_data['products_model'] . '</b></font> Product Info Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_med']) . '</b></font><br>';// make list of missing pics
}

if (!file_exists('images/' . $get_data['products_image'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing <font color="Red"><b>' . $get_data['products_model'] . '</b></font> Product Listing Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image']) . '</b></font><br>';// make list of missing pics
}

}

if ($hold_miss_pic>0){
echo '<font size="4">Missing <font color="Red"><b>' . $hold_miss_pic . '</b></font> picture(s): <br><br>' . $hold_miss_pic_list . '</font>';// print the info
}else
{
echo 'No missing product_info or product_listing page images';// print the info
}

?>


edited, added more verbiage and test for the includes file


Last edited by pyramids on Sun Oct 08, 2006 2:40 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: SiteTool: Check for missing product images?
PostPosted: Thu Oct 05, 2006 9:20 pm 
Offline
CRE Addict
User avatar

Joined: Sun Apr 24, 2005 12:00 am
Posts: 178
Location: Tampa, FL
Thanks man

This really helped me out. Especially in the music biz even!

You're becoming the new Chemo of CRE Loaded.

_________________
www.MONSTERTUNES.net
Digital Downloads
House Music
Records and CDs
CD Duplication
Mastering services

Built with the power of CRE Loaded 6.2 basic


Top
 Profile  
 
 Post subject: Re: SiteTool: Check for missing product images?
PostPosted: Wed Dec 27, 2006 3:11 pm 
Offline
CRE Freak
User avatar

Joined: Tue Jul 12, 2005 12:00 am
Posts: 58
pyramids,

you stated in your post that we need to copy this file in the root and run it. i copied the file to the root. how do i run it?


Top
 Profile  
 
 Post subject: Re: SiteTool: Check for missing product images?
PostPosted: Wed Dec 27, 2006 4:24 pm 
Offline
CRE Talented
User avatar

Joined: Thu Feb 09, 2006 1:00 am
Posts: 495
copy the text, paste into notepad, save as missing_images_check.php, upload to your shop directory, so, mine was www.mysite.com/shop/
then type in the browser address bar:
www.your-site.com/shop/missing_images_check.php

IF /shop is where your loaded is. if it's in /catalogue then it would be www.your-site.com/catalogue/missing_images_check.php or
www.your-site.com/missing_images_check.php if loaded is in the root directory.

_________________
Image
.: www.porn18dvds.com :NOT Cre Loaded yet, but still great dvds


Top
 Profile  
 
 Post subject: Re: SiteTool: Check for missing product images?
PostPosted: Wed Dec 27, 2006 11:56 pm 
Offline
CRE Addict
User avatar

Joined: Sat Sep 09, 2006 12:00 am
Posts: 153
thanks , very useful script :-)

Missing 4 picture(s):

MissingSEN9379R Product Info Page Image: SEN9379S.jpg
Missing SEN9379R Product Listing Page Image: SEN9379S.jpg
MissingSEN2018p Product Info Page Image: SEN2018S.jpg
Missing SEN2018p Product Listing Page Image: SEN2018S.jpg


Top
 Profile  
 
 Post subject: Re: SiteTool: Check for missing product images?
PostPosted: Thu Dec 28, 2006 12:00 am 
Offline
CRE Talented
User avatar

Joined: Thu Feb 09, 2006 1:00 am
Posts: 495
4? lol, I was missing about 230, helped me heaps!.. noway I could have found them all on my own. :D

_________________
Image
.: www.porn18dvds.com :NOT Cre Loaded yet, but still great dvds


Top
 Profile  
 
 Post subject: Re: SiteTool: Check for missing product images?
PostPosted: Thu Dec 28, 2006 7:08 pm 
Offline
CRE Newbie
User avatar

Joined: Tue Dec 05, 2006 1:00 am
Posts: 19
thanks for the code. after loading 3300 comics i still need 2200 pics to up load. at least i know which ones now thanks


Top
 Profile  
 
 Post subject: Re: SiteTool: Check for missing product images?
PostPosted: Fri Dec 29, 2006 2:34 am 
Offline
CRE Talented
User avatar

Joined: Fri Mar 31, 2006 1:00 am
Posts: 496
this is great ! thanks man


Top
 Profile  
 
 Post subject: Re: SiteTool: Check for missing product images?
PostPosted: Tue Jan 02, 2007 5:55 pm 
Offline
CRE Freak
User avatar

Joined: Tue Jul 12, 2005 12:00 am
Posts: 58
Thanks pyramids. works great!!!!


Top
 Profile  
 
 Post subject: Re: SiteTool: Check for missing product images?
PostPosted: Sat Apr 03, 2010 12:33 am 
Offline
CRE Freak

Joined: Sun Mar 18, 2007 12:00 am
Posts: 105
Location: Brisbane, Australia
Pyramids. Thanks for the great script (back in 2006)

I have tweaked slightly for B2B so that it shows:
1. Groups of access for each item
2. All image categories including
    products_image
    products_image_lrg
    products_image_med
    products_image_sm_1
    products_image_sm_2
    products_image_sm_3
    products_image_sm_4
    products_image_sm_5
    products_image_sm_6
    products_image_xl_1
    products_image_xl_2
    products_image_xl_3
    products_image_xl_4
    products_image_xl_5
    products_image_xl_6

Here's the code if you're interested:
Code:
<?php
// missing_images_check.php vers 1.0 by pyramids 09172006
// For product info and product listing pages
// Updated by BABBiX on April 3rd 2010

$hold_miss_pic = 0;// base for missing pics
$hold_miss_pic_list = '';// hold the list of missing pics
$hold_status = 1;// for active items set to 1, otherwise set to 0

if (!file_exists('includes/configure.php')) {echo "<font size=4>Can't find the <b>'includes/configure.php'</b> file.   <b>NOTE: </b>This script 'missing_images_check.php' needs to run in the shop root</font>";die();}

require ('includes/configure.php');// login info

$conn = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD) or die(mysql_error());// connect to db

$select_db = mysql_select_db(DB_DATABASE, $conn) or die(mysql_error());//select the right db

   $sql = "select p.products_image as products_image, p.products_image_lrg as products_image_lrg, p.products_image_med as products_image_med, p.products_image_sm_1 as products_image_sm_1, p.products_image_sm_2 as products_image_sm_2, p.products_image_sm_3 as products_image_sm_3,   p.products_image_sm_4 as products_image_sm_4, p.products_image_sm_5 as products_image_sm_5,  p.products_image_sm_6 as products_image_sm_6,  p.products_image_xl_1 as products_image_xl_1,  p.products_image_xl_2 as products_image_xl_2,  p.products_image_xl_3 as products_image_xl_3,  p.products_image_xl_4 as products_image_xl_4,  p.products_image_xl_5 as products_image_xl_5,  p.products_image_xl_6 as products_image_xl_6,   p.products_model as products_model, p.products_group_access as products_group_access from products p where p.products_status = '" . $hold_status . "'";
   $result = mysql_query($sql, $conn) or die(mysql_error());

   //run through every product with the status of "on" (default) check to see if the images exists
while ($get_data = mysql_fetch_array($result)){



if (!file_exists('images/' . $get_data['products_image'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image <font color="Red"><b>' . $get_data['products_model'] . '</b></font> Product Listing Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}


if (!file_exists('images/' . $get_data['products_image_med'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image_med <font color="Red"><b> ' . $get_data['products_model'] . '</b></font> Product Info Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_med']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}


if (!file_exists('images/' . $get_data['products_image_lrg'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image_lrg <font color="Red"><b>' . $get_data['products_model'] . '</b></font> Product Listing Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_lrg']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}

if (!file_exists('images/' . $get_data['products_image_sm_1'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image_sm_1 <font color="Red"><b> ' . $get_data['products_model'] . '</b></font> Product Info Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_sm_1']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}

if (!file_exists('images/' . $get_data['products_image_sm_2'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image_sm_2 <font color="Red"><b> ' . $get_data['products_model'] . '</b></font> Product Info Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_sm_2']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}

if (!file_exists('images/' . $get_data['products_image_sm_3'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image_sm_3 <font color="Red"><b> ' . $get_data['products_model'] . '</b></font> Product Info Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_sm_3']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}

if (!file_exists('images/' . $get_data['products_image_sm_4'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image_sm_4 <font color="Red"><b> ' . $get_data['products_model'] . '</b></font> Product Info Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_sm_4']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}

if (!file_exists('images/' . $get_data['products_image_sm_5'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image_sm_5 <font color="Red"><b> ' . $get_data['products_model'] . '</b></font> Product Info Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_sm_5']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}

if (!file_exists('images/' . $get_data['products_image_sm_6'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image_sm_6 <font color="Red"><b> ' . $get_data['products_model'] . '</b></font> Product Info Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_sm_6']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}

if (!file_exists('images/' . $get_data['products_image_xl_1'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image_xl_1 <font color="Red"><b> ' . $get_data['products_model'] . '</b></font> Product Info Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_xl_1']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}

if (!file_exists('images/' . $get_data['products_image_xl_2'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image_xl_2 <font color="Red"><b> ' . $get_data['products_model'] . '</b></font> Product Info Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_xl_2']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}

if (!file_exists('images/' . $get_data['products_image_xl_3'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image_xl_3 <font color="Red"><b> ' . $get_data['products_model'] . '</b></font> Product Info Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_xl_3']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}

if (!file_exists('images/' . $get_data['products_image_xl_4'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image_xl_4 <font color="Red"><b> ' . $get_data['products_model'] . '</b></font> Product Info Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_xl_4']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}

if (!file_exists('images/' . $get_data['products_image_xl_5'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image_xl_5 <font color="Red"><b> ' . $get_data['products_model'] . '</b></font> Product Info Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_xl_5']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}

if (!file_exists('images/' . $get_data['products_image_xl_6'])){
$hold_miss_pic++;// count missing pics
$hold_miss_pic_list .= ' Missing products_image_xl_6 <font color="Red"><b> ' . $get_data['products_model'] . '</b></font> Product Info Page Image: <font color="Red"><b>' . strip_tags($get_data['products_image_xl_6']) . '</b></font> ' . strip_tags($get_data['products_group_access']) . '</b></font><br>';// make list of missing pics
}


}

if ($hold_miss_pic>0){
echo '<font size="4">Missing <font color="Red"><b>' . $hold_miss_pic . '</b></font> picture(s): <br><br>' . $hold_miss_pic_list . '</font>';// print the info
}else
{
echo 'No missing product_info or product_listing page images';// print the info
}

?>


Save to a new file name and upload to whereever you would place the original file.

_________________
Image


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

Board index » Loaded Commerce Support » Tips & Tricks

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
It is currently Wed May 23, 2012 7:03 pm
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Login

Forums Latest Activity

Top Listing

1. Cart2Cart - Shopping...
    Category: Shopping Cart Database Conversion Scripts
    
2. Points & Rewards PLUS!...
    Category: Add-Ons
    
3. Configuration Server...
    Category: Fixes
    
4. Credit Card with CCV
    Category: Payment Modules
    
5. CC7333_ATS
    Category: Templates
    
Show more...

© CRE Loaded is a product of Chain Reaction Ecommerce, Inc. Usage & Privacy Policy