News:

Support the VirtueMart project and become a member

Main Menu

Product Images - Clean up unused images ?

Started by Shimon Hirschhorn, May 16, 2016, 13:54:43 PM

Previous topic - Next topic

Shimon Hirschhorn

Hi,

I have many files in my public_html/images/stories/virtuemart/product/ directory and I am looking for solutions to solve this problem.

1) Is there a utility to clean up (remove or copy elsewhere) all images that are not being used?

2) Is there a way to organize images ?  eg have sub-directories under public_html/images/stories/virtuemart/product/ for each manufacturer ?  this would make each sub-dir much more manageable.

Thanks

Jörgen

Hello

Yes this is possible. I arrange all my images in that way. The only problem is the upload of images. Using the media tools for Joomla or ftp solves that somehow. The next step is kind of awkward, You can use syncronize media in VM Tools. And then assign the syncronized items to Your products and change the description for the items that are found during syncronization.

I don´t know of any cleaning tool. But as You say this helps making everything more easy to manage.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Shimon Hirschhorn

Thank you for your reply.

I upload images via FTP, so that is not a problem.
I upload products via CSVI, so I guess that I will have to edit the template each time and set the "Location product files " to the "images/stories/virtuemart/product/manufacture_1" directory.  This is a pain, but not that big a deal.

I do not understand the rest of the procedure.  Is there documentation somewhere that I can read more.  The VM documentation has a paragraph that explains it, but it is still not clear to me.

Thanks

Jörgen

Sorry  :-[

This is not really clear I know.

Go into Product images and use search images. Writing for example cap in the search for images box is equal to a search for the unique filename identifier *cap*  (n.b this does not have to be the same as the filename on disk).

You will see up to 16 images, choose the right image or press + for the next 16 images. Then click on the edit image iformation Icon on the image You selected and edit as You wish.

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Shimon Hirschhorn

Thanks.

I have thousands of images. This is not something that I want to do manually, image by image.

I will need a way to tell the database where everything is.

Ghost

http://shop.st42.fr/en/products/virtuemart-media-folder-clear.htm

There is this plugin. If you get an error, add this line to vmmedia_clear.php file:

jimport('joomla.filesystem.file');

Shimon Hirschhorn

Jorgen, (sorry no ubshlang on my keyboard)

VM has a  section in configuration/templates for Media File Settings where your set the "images/stories/virtuemart/product/"

If I upload the images to the images/stories/virtuemart/product/man1/ directory and use CSVI to import the product and tell it that the image is there, will it know to create the thumbnail in
images/stories/virtuemart/product/man1/resized ? and will VM know to find it there to display it ?

Shimon

Studio 42

Quote from: Ghost on May 17, 2016, 09:10:17 AM
There is this plugin. If you get an error, add this line to vmmedia_clear.php file:
jimport('joomla.filesystem.file');
Hi Ghost,
I really appreciate when someone report me a bug ;)
Patrick

Shimon Hirschhorn

Patrick,

What do the two buttons do?

Clear - I assume clears the images that are not used.  I would actually prefer to move them to "recycle" directory
Error - ?? What does Error do ?

Shimon

Jörgen

Hi Shimon

Have seen this extension:
http://shop.ekerner.com/index.php/shop/joomla-extensions/com-vmproductscsv-detail

I seems to be able to add images and make the media items neccessary if they are uploaded to You site. Other URL's than the standard Products can be used and You don´t have to syncronize medias through Virtuemart

regards

Jörgen @ Kreativ Fotografi
Joomla 3.9.18
Virtuemart 3.4.x
Olympiantheme Hera (customized)
This reflects current status when viewing old post.

Studio 42

The problem is that i use Joomla core function and this are in some case not loaded. So i need to add it.
1 button remove images : difference from images in folder and DB (unused files).
1 button remove DB entries : inexisting files.
If you need a "recycle" directory, best is to do a backup before using the tool(or zip all your images). The tool is only here to clean all bugs in db and all unused files.
Regards,
Patrick

Studio 42


Shimon Hirschhorn

Patrick,

I like the first part : Getting rid of files that are cluttering up the product images directory.

As far as deleting non-existent images from the DB, I don't like this.  I would rather have a list of missing images ( and the products that they belong to) so that I can find them and upload them.

Shimon

PRO

I wrote this to find images not assigned to products


<?php function fullmedia(){
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__virtuemart_medias'));
$db->setQuery($query);
$rows=$db->loadAssocList();
$html='';
foreach ($rows as $row){
$mid=$row['virtuemart_media_id'];
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query->select('*');
$query->from($db->quoteName('#__virtuemart_product_medias'));
$query->where($db->quoteName('virtuemart_media_id')." = ".$db->quote($mid));
$db->setQuery($query);
$row2 =$db->loadAssocList();
if (empty($row2)){
$html.=$mid.'<br/>';
}
}
return $html;


}
?>
<?php echo fullmedia();?>

Studio 42

Hi shimon,

The tool is GNU/GPL, so you can modify it for your needs.
Remember to send back your changes ;)

Patrick