I am creating products and adding images to them using
$configurable->addImageToMediaGallery($filePath, array('image', 'small_image', 'thumbnail'), false);
This works fine. However I am getting files save in the media folder with names like:
/media/catalog/product/w/w/wwwhatever_2_4_1_2_1_3_1.png
After a few test runs the proliferation of these media files is jolly alarming. I am also attaching the files to the simple products using the same technique as for the configurable.
I have tried setting $uploader->setAllowRenameFiles(false); in various places, which I thought might fix the problem. But that didn't work.
I am looking for a solution that ideally enables the file renaming to work as normal during normal admin operation, e.g. for CMS files etc., but breaks the rule just for my product creation module.