Jump to content
Sign in to follow this  
stragami

Remove Unused Images

Recommended Posts

i'm trying to make the contribution to work but i have the following problem:

 

the list from DB is correct...

the list from server is correct...

the differences are correct...

 

when i'm trying to rename nothing happens...!!!??? Just reload the remove_unused_images.php!!!

 

 

I'm trying to make this to work localy with Wampserver...

 

please help

I believe this was answered on page 1, let me know otherwise.

Share this post


Link to post
Share on other sites

I try to change the paths...

 

I try all the possible combinations

 

$root_dir = 'C:/wamp/www/eshop2/catalog'; // look in this root

 

$base_dir = 'http://127.0.0.1/eshop2/catalog'; // for links

i have downloaded the new version of the contribution with the following code

 

$msg_s = '<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"><html>

<head><title>Rename Unused Images</title></head><body><!-- body_text //--><table bgcolor="Lime" width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td align="center"><h2>Rename Images that are not being called from the Database</h2></td></tr></table><br><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td valign="top"><b><font size="4">The images listed below were renamed</font></b><br><br>';

 

$hold_change = 0;

 

//missing code line 318

$checked_unused_images = $HTTP_POST_VARS['checked_unused_images'];

 

But nothing happens when i'm trying to rename just refresh the page remove_unused_images

 

I notice that when the cursor is over Check All Boxes | Uncheck All Boxes the link is http://127.0.0.1/eshop2/catalog/admin/remove_unused_images.php#button and when the cursor is over the rename button the link is remove_unused_images.php

...

 

Is that right?????

 

I don't know if i have to set permission for the image folder but i think that localy this is not necessary...

Share this post


Link to post
Share on other sites
I try to change the paths...

 

I try all the possible combinations

 

$root_dir = 'C:/wamp/www/eshop2/catalog'; // look in this root

 

$base_dir = 'http://127.0.0.1/eshop2/catalog'; // for links

i have downloaded the new version of the contribution with the following code

 

$msg_s = '<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"><html>

<head><title>Rename Unused Images</title></head><body><!-- body_text //--><table bgcolor="Lime" width="100%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td align="center"><h2>Rename Images that are not being called from the Database</h2></td></tr></table><br><table width="80%" border="0" align="center" cellpadding="0" cellspacing="0"><tr><td valign="top"><b><font size="4">The images listed below were renamed</font></b><br><br>';

 

$hold_change = 0;

 

//missing code line 318

$checked_unused_images = $HTTP_POST_VARS['checked_unused_images'];

 

But nothing happens when i'm trying to rename just refresh the page remove_unused_images

 

I notice that when the cursor is over Check All Boxes | Uncheck All Boxes the link is http://127.0.0.1/eshop2/catalog/admin/remove_unused_images.php#button and when the cursor is over the rename button the link is remove_unused_images.php

...

 

Is that right?????

 

I don't know if i have to set permission for the image folder but i think that localy this is not necessary...

 

 

on the top of the page there are two notices...

 

Notice: Undefined variable: HTTP_POST_VARS in C:\wamp\www\eshop2\catalog\admin\remove_unused_images.php on line 282

 

Notice: Undefined variable: HTTP_POST_VARS in C:\wamp\www\eshop2\catalog\admin\remove_unused_images.php on line 311

Share this post


Link to post
Share on other sites
on the top of the page there are two notices...

 

Notice: Undefined variable: HTTP_POST_VARS in C:\wamp\www\eshop2\catalog\admin\remove_unused_images.php on line 282

 

Notice: Undefined variable: HTTP_POST_VARS in C:\wamp\www\eshop2\catalog\admin\remove_unused_images.php on line 311

 

If you are running on a local machine it sounds like a php issue or a path issue.

 

Follow lines 282 and 311 and see why it is undefined, did you alter the script?

 

Regards,

Jeff

Share this post


Link to post
Share on other sites
If you are running on a local machine it sounds like a php issue or a path issue.

 

Follow lines 282 and 311 and see why it is undefined, did you alter the script?

 

Regards,

Jeff

 

line 282

if ($HTTP_POST_VARS['action'] == 'rename') {}else{

 

line 311

if ($HTTP_POST_VARS['action'] == 'rename') {

Share this post


Link to post
Share on other sites

Hello,

I still having the problem:

The con search my image, image_medium and image_large folders. That`s great!

But it doesn`t search my images_upload folder. It does in the SERVER images, but not in the List of DATABASE images!

How/where could I get the right path for it???

There`re images that are still in use, but they`re displayed in the List of UNUSED images!

uploadeu1.jpg

Also the images on the server are displayed with subfolder.

But in the database, they`re listed without the folder name...

for example: medium

So the images are displayed as unused!

Is there a solution yet?!

Thank you!

Share this post


Link to post
Share on other sites
line 282

if ($HTTP_POST_VARS['action'] == 'rename') {}else{

 

line 311

if ($HTTP_POST_VARS['action'] == 'rename') {

 

This undefined var is referring to <input type="hidden" name="action" value="rename">

 

So if it is undefined I can only guess that it is in the code somewhere, maybe the code was altered?

Share this post


Link to post
Share on other sites
Hello,

I still having the problem:

The con search my image, image_medium and image_large folders. That`s great!

But it doesn`t search my images_upload folder. It does in the SERVER images, but not in the List of DATABASE images!

How/where could I get the right path for it???

There`re images that are still in use, but they`re displayed in the List of UNUSED images!

Also the images on the server are displayed with subfolder.

But in the database, they`re listed without the folder name...

for example: medium

So the images are displayed as unused!

Is there a solution yet?!

Thank you!

 

Post ALL paths to all image folders that exist on the server:

 

It might look like: shop/images/medium; shop/images/large; etc...

 

Then post the variables:

$images_dir =

$more_folders =

 

We'll see if we can help.

 

Regards,

Jeff

Share this post


Link to post
Share on other sites
This undefined var is referring to <input type="hidden" name="action" value="rename">

 

So if it is undefined I can only guess that it is in the code somewhere, maybe the code was altered?

 

i used

remove__unused_images.php v1.1a by pyramids 11-6-2008

without any other changes exept the paths...

 

if you want i can mail you the full code

Share this post


Link to post
Share on other sites
i used

remove__unused_images.php v1.1a by pyramids 11-6-2008

without any other changes exept the paths...

 

if you want i can mail you the full code

 

The latest script was updated to have this code:

 

//missing code line 311

$checked_unused_images = $HTTP_POST_VARS['checked_unused_images'];

 

Check to see if this code is there, if not than add it (see forum page 1 for more info)

Share this post


Link to post
Share on other sites
The latest script was updated to have this code:

 

//missing code line 311

$checked_unused_images = $HTTP_POST_VARS['checked_unused_images'];

 

Check to see if this code is there, if not than add it (see forum page 1 for more info)

 

the version i use has the following code...!!!!

//missing code line 318

$checked_unused_images = $HTTP_POST_VARS['checked_unused_images'];

Share this post


Link to post
Share on other sites
the version i use has the following code...!!!!

//missing code line 318

$checked_unused_images = $HTTP_POST_VARS['checked_unused_images'];

 

OK all I can think of is it is a php issue

Share this post


Link to post
Share on other sites
Post ALL paths to all image folders that exist on the server:

 

It might look like: shop/images/medium; shop/images/large; etc...

 

Then post the variables:

$images_dir =

$more_folders =

 

We'll see if we can help.

 

Regards,

Jeff

Hi Jeff,

 

thanks for helping me out!

Here are my folders IN the images folder:

banners, default, dvd, icons, infobox, large, mail, medium, upload.

Now I`d like to compare the 4 main folders (images, images/medium, images/large, images/upload).

That would be enough for me! So I choose the main dir as images!

And the subfolder at $more_folders = array!

Here`s my code:

// look in this images folder - do not add more folders here - just the main one
$images_dir = 'images';

// if you add more sub folders of $images_dir then edit as EX: $more_folders = array("thumb","full");
// you must make sure the corresponding tables are in $table_array
$more_folders = array("medium","large","upload");

// to add more tables use ex: $table_array = array("products_image","products_image_med");
// see below for possible image names
$table_array = array("products_image","products_image_medium","products_image_large");

No problem so far!

But how is the array for the upload folder called???

What do I write in $table_array = array for it?

I can`t find the upload folder in mysql...

I think that`s the problem!?!

I`ve tried products_image_upload, but it will cause an error:

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at D:\vhosts\Mysite.COM\httpdocs\catalog\admin\remove_unused_images.php:2) in D:\vhosts\Mysite.COM\httpdocs\catalog\admin\includes\functions\sessions.php on line 102

Here's line 102 of my sessions.php

return session_start();

Thank you for your time and support!

I`m waiting for your solution!

Share this post


Link to post
Share on other sites
// look in this images folder - do not add more folders here - just the main one
$images_dir = 'images';

// if you add more sub folders of $images_dir then edit as EX: $more_folders = array("thumb","full");
// you must make sure the corresponding tables are in $table_array
$more_folders = array("medium","large","upload");

// to add more tables use ex: $table_array = array("products_image","products_image_med");
// see below for possible image names
$table_array = array("products_image","products_image_medium","products_image_large");

 

However you named the upload images in the database that will need to be put into the $table_array

 

Might look like:

$table_array = array("products_image_upload","products_image","products_image_medium","products_image_large");

 

You need to do this part, I can only guess what you named the upload images.

 

Note: If you don't have the "upload" images listed in the database then you can't have them listed to be removed.

 

On the errors, I can't help you there.

Share this post


Link to post
Share on other sites
However you named the upload images in the database that will need to be put into the $table_array

 

Might look like:

$table_array = array("products_image_upload","products_image","products_image_medium","products_image_large");

 

You need to do this part, I can only guess what you named the upload images.

 

Note: If you don't have the "upload" images listed in the database then you can't have them listed to be removed.

 

On the errors, I can't help you there.

Hi,

any idea where I can find tha correct name for the upload folder in the database?

Thanks for your support!

Share this post


Link to post
Share on other sites

Hi again,

my other problem is, that the server list the images WITH subfolders (like medium, large...)

and the database display them WITHOUT the subfolder, like they are direct in the IMAGE folder!

Why is this happen???

Thanks for your support!

Share this post


Link to post
Share on other sites
Hi again,

my other problem is, that the server list the images WITH subfolders (like medium, large...)

and the database display them WITHOUT the subfolder, like they are direct in the IMAGE folder!

Why is this happen???

Thanks for your support!

 

If I understand you correctly:

 

Find:

//$files[$i] = str_replace($root_images_dir . '/', "", $files[$i]);// remove the root part of the image name

 

Change to:

$files[$i] = str_replace($root_dir . '/', "", $files[$i]);// remove the root part of the image name but keep the image folders

 

this will add back the images folder name and the sub image folder names for both the server listing and the list of unused images

Share this post


Link to post
Share on other sites

Hi again,

the problem is NOT the server, it IS the DATABASE!

The server lists the files correct with subfolder.

The database doesn`t show the included subfolders!

Your fix shows the folder for the server and in the unused list...

But the database shows them all as being in the main image folder!

Here`s the code the error could be in:

// put the images in an array
while ($image_info = mysql_fetch_array($image_info_query))
{
 if ($numb_tables)
 {
for ($i = 0; $i < $numb_tables; ++$i)
{
  if( strpos($image_info[$table_array[$i]], 'jpg') || strpos($image_info[$table_array[$i]], 'gif') || strpos($image_info[$table_array[$i]], 'png') )
  {
  if($image_info[$table_array[$i]]){$full_image_list[] = strip_tags($image_info[$table_array[$i]]);}//put all db images into 1 array
  }
}
 }
}

 $full_image_list = array_unique($full_image_list);
 sort($full_image_list);// list from db

 $count_db_list = count($full_image_list);//number of images installed in the database

// end reading the database for installed images

Greetings!

Edited by ChilliNr1

Share this post


Link to post
Share on other sites
Hi again,

the problem is NOT the server, it IS the DATABASE!

The server lists the files correct with subfolder.

The database doesn`t show the included subfolders!

Your fix shows the folder for the server and in the unused list...

But the database shows them all as being in the main image folder!

Here`s the code the error could be in:

 

If I understand your request to customize the script for you, you want to show what folders the database images are in?

 

if so, you can customize the script for what you want by:

 

find:

	 $msg .= $full_image_list[$i] . "<br>";// print server images
 }else{
 $hold_red = 1;
$msg .= '<font color="Red">'.$full_image_list[$i] . '</font><br>';// print server images that are not in the server

 

customize to:

	 $msg .= $images_dir.'/'.$full_image_list[$i] . "<br>";// print server images
 }else{
 $hold_red = 1;
$msg .= '<font color="Red">'.$images_dir.'/'.$full_image_list[$i] . '</font><br>';// print server images that are not in the server

Share this post


Link to post
Share on other sites

Hi,

your code solve the problem with the pics in the main "images" folder,

but it doesn`t help me out with the subfolders?!

ALL pics are now displayed with images/xxx.jpg

The others like images/large/xxx.jpg are displayed like images/xxx.jpg and marker as unused...

Any idea else?

Thank you so far!

Share this post


Link to post
Share on other sites

I am confused. I thought this contribution would give you a list of images on your server that are not in use by your catalog. I already have the contribution missing images report. That contribution gives me a list of all products in my catalog that do not have pictures. (just like this contribution - they are listed in red in the db section).

 

I need a contribution that will tell me what images I have on my server that are not in use on my catalog or db. Will this do that? I am sure I have pictures that are no longer in use. My site has over 2500 items and its changed all the time. The only images that show up under the server column are ones that are directly under images, no sub folder.

 

When I click on rename all checked items, I get an internet explorer error, page can not be found? How do I fix that? It happens no matter if I check one, or use check all.

Share this post


Link to post
Share on other sites

fixed my first problem with the subfolders name under images.

 

Still can not get the rename images to work.

 

It shows that I have 211 images not being used.

 

Rename Images that are not being called from the Database

 

*********************

List of DATABASE images stored

for the shop

*********************

The total number of images in the db are 2444

 

The database is being read as select p.products_image from products p

 

Candles/12014.gif

Candles/12015.gif

 

The data base images report is ok

 

List of SERVER images

*********************

The total number of images on the server are 3473

 

The following folders are being read:

/home/username/public_html/gifts/images

/home/username/public_html/gifts/images/animal

/home/username/public_html/gifts/images/baby

 

The server info is correct. Has the correct address of the images

 

The problem is the difference section.

 

List of UNUSED images, they were not found in the database

*********************

The total number of REPORTED unused images is 1240

 

It appears that you have 211 (they are listed in red in the DB list, if list is displayed) images listed in the database that do not exist on the server

 

List End - Click Here

 

account_notifications.gif

account_notifications1.gif

account_orders.gif

account_orders1.gif

account_personal.gif

account_personal1.gif

ajax-loader.gif

animal/12028.gif

animal/12029.gif

animal/12087.gif

 

Ok - Problem when I click the button to rename the images, it goes to http 404 not found. I noticed the image location is wrong. It shows http://gifts.sitename.com/admin/images/animal/12028.gif. The location of the image is correct under the server side, and the images are correct on the database side. The image location under the difference section is incorrect.

 

Notice: http://gifts.websiteaddress.com/admin/imag...nimal/12028.gif

and it should be: http://www.websiteaddress.com/gifts/images/animal/12028.gif

 

What do I need to change.

Share this post


Link to post
Share on other sites

fixed my first problem with the subfolders name under images.

 

Still can not get the rename images to work.

 

It shows that I have 211 images not being used.

 

Rename Images that are not being called from the Database

 

*********************

List of DATABASE images stored

for the shop

*********************

The total number of images in the db are 2444

 

The database is being read as select p.products_image from products p

 

Candles/12014.gif

Candles/12015.gif

 

The data base images report is ok

 

List of SERVER images

*********************

The total number of images on the server are 3473

 

The following folders are being read:

/home/username/public_html/gifts/images

/home/username/public_html/gifts/images/animal

/home/username/public_html/gifts/images/baby

 

The server info is correct. Has the correct address of the images

 

The problem is the difference section.

 

List of UNUSED images, they were not found in the database

*********************

The total number of REPORTED unused images is 1240

 

It appears that you have 211 (they are listed in red in the DB list, if list is displayed) images listed in the database that do not exist on the server

 

List End - Click Here

 

account_notifications.gif

account_notifications1.gif

account_orders.gif

account_orders1.gif

account_personal.gif

account_personal1.gif

ajax-loader.gif

animal/12028.gif

animal/12029.gif

animal/12087.gif

 

Ok - Problem when I click the button to rename the images, it goes to http 404 not found. I noticed the image location is wrong. It shows http://gifts.sitename.com/admin/images/animal/12028.gif. The location of the image is correct under the server side, and the images are correct on the database side. The image location under the difference section is incorrect.

 

Notice: http://gifts.websiteaddress.com/admin/imag...nimal/12028.gif

and it should be: http://www.websiteaddress.com/gifts/images/animal/12028.gif

 

What do I need to change.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×