How to Clean Up Image Files

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
13 years ago
Hello, one of my clients is experiencing an picture upload error that says the primary database is full. I know I can switch this to save the files in the folder BUT then her previous pictures in the database will not work. She has alot of products so I dont really wanna switch all the pictures over.

I was wondering what the easiest way was to make more room in the database by deleting unused pictures? Or if there was any other solutions anyone has!

Thanks guys.


Oh yeah, Im on Godaddy (which super stinks I know, But Cannot change hosting right now)
13 years ago
I have a similar issue.
Also using GoDaddy.

We just started with nopCommerce.
We did a blank install (no demo data), added French language pack and a dozen products with 8 categories.
Now it errors out because the database is full (200mb).

I originally thought that 200mb was quite enough for our needs.
But now I am wondering...  Is it standard size for what I've described above?
If images are stored in database, maybe the picture we uploaded are too big...

Anyone can help us?

I thought about calling GoDaddy about it but it seems, seing the above post, that it will not be of any help.

Also, I do not have permission for executing DBCC Shrinkdatabase. If you believe it is going to help, I may try to ask technical support at GoDaddy to do it for me.
13 years ago
Ok, I sort of solved the issue.

My problem was the log table.  Had 235000 records in it.
I deleted them all and went down to 16mb.

Don't count on GoDaddy support for this.
I opened a ticket and the solution that was proposed to me was :

Create another database and move some tables into it.
No jokes.
10 years ago
I recently used this script to get a list of pictures that are no longer in use. Please do take backup copies of the picture files before deleting them in case this script doesn't cover all bases.

When deleting pictures, remember to delete both the original and thumbnail files.


select * from (
  select
    p.Id,
    Manufacturer = (select count(*) from Manufacturer where PictureId=p.Id),
    Product = (select count(*) from Product_Picture_Mapping where PictureId=p.Id),
    ProductVariantAttributeValue = (select count(*) from ProductVariantAttributeValue where PictureId=p.Id),
    Category = (select count(*) from Category where PictureId=p.Id),
    Settings = (select count(*) from Setting where value=cast(p.Id as varchar(max)) and name like '%picture%id%')
  from
    dbo.Picture p
) p
where
  p.Manufacturer=0
  and p.Product=0
  and p.ProductVariantAttributeValue=0
  and p.Category=0
  and Settings=0

--select column_name, table_name from information_schema.columns where column_name like '%picture%'
--select * from setting where name like'%picture%id%'
9 years ago
bernhof wrote:
I recently used this script to get a list of pictures that are no longer in use. Please do take backup copies of the picture files before deleting them in case this script doesn't cover all bases.

When deleting pictures, remember to delete both the original and thumbnail files.


select * from (
  select
    p.Id,
    Manufacturer = (select count(*) from Manufacturer where PictureId=p.Id),
    Product = (select count(*) from Product_Picture_Mapping where PictureId=p.Id),
    ProductVariantAttributeValue = (select count(*) from ProductVariantAttributeValue where PictureId=p.Id),
    Category = (select count(*) from Category where PictureId=p.Id),
    Settings = (select count(*) from Setting where value=cast(p.Id as varchar(max)) and name like '%picture%id%')
  from
    dbo.Picture p
) p
where
  p.Manufacturer=0
  and p.Product=0
  and p.ProductVariantAttributeValue=0
  and p.Category=0
  and Settings=0

--select column_name, table_name from information_schema.columns where column_name like '%picture%'
--select * from setting where name like'%picture%id%'


Thank you , very useful!
5 years ago
You probably haven't changed the media setting in admin panel to save images in file system rather than database.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.