uddhava Posted July 7, 2010 Share Posted July 7, 2010 I found a lot of files in the /img/tmp folder with the following names :ps_import05UQTLps_import06doUG...Probably these are the temporary image files that are created during import/resizing/etc.Can these be deleted?And why arent these deleted after import ?A default install of prestashop has no files in the /img/tmp dir.From that i conclude i can delete all files except the index.php Link to comment Share on other sites More sharing options...
rocky Posted July 8, 2010 Share Posted July 8, 2010 That's correct. You can delete all files in /img/tmp except for index.php. You may have found another bug in the import, unless the import script timed out on your site and didn't get the chance to clean up its temporary files. Link to comment Share on other sites More sharing options...
uddhava Posted July 9, 2010 Author Share Posted July 9, 2010 I found this function in the AdminTab Class : (line 708)protected function uploadImageThis apparently deletes the temporary file here : if ($this->afterImageUpload()) { unlink($tmpName); return true; } Now i wonder if this function is called when performing an csv import Link to comment Share on other sites More sharing options...
uddhava Posted July 9, 2010 Author Share Posted July 9, 2010 I found a solution to the temporary import files.I have added another php delete command (unlink) to the code in the AdminImport.php file.File : /admin/tabs/AdminImport.phpLine : 389-404Old code if (@copy($url, $tmpfile)) { deleteImage($id_entity,$id_image); imageResize($tmpfile, $path.'.jpg'); $imagesTypes = ImageType::getImagesTypes($entity); foreach ($imagesTypes AS $k => $imageType) imageResize($tmpfile, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']); } else { unlink($tmpfile); return false; } return true; } New code : if (@copy($url, $tmpfile)) { deleteImage($id_entity,$id_image); imageResize($tmpfile, $path.'.jpg'); $imagesTypes = ImageType::getImagesTypes($entity); foreach ($imagesTypes AS $k => $imageType) imageResize($tmpfile, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']); } else { unlink($tmpfile); return false; } unlink($tmpfile); return true; } Link to comment Share on other sites More sharing options...
aiynoon Posted January 16, 2014 Share Posted January 16, 2014 I found a solution to the temporary import files. I have added another php delete command (unlink) to the code in the AdminImport.php file. File : /admin/tabs/AdminImport.php Line : 389-404 Old code if (@copy($url, $tmpfile)) { deleteImage($id_entity,$id_image); imageResize($tmpfile, $path.'.jpg'); $imagesTypes = ImageType::getImagesTypes($entity); foreach ($imagesTypes AS $k => $imageType) imageResize($tmpfile, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']); } else { unlink($tmpfile); return false; } return true; } New code : if (@copy($url, $tmpfile)) { deleteImage($id_entity,$id_image); imageResize($tmpfile, $path.'.jpg'); $imagesTypes = ImageType::getImagesTypes($entity); foreach ($imagesTypes AS $k => $imageType) imageResize($tmpfile, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']); } else { unlink($tmpfile); return false; } unlink($tmpfile); return true; } Hi, I have the latest prestashop version 1.5.6.1. I don't see the files that you mentioned here. Did this code resolved your issue? What was the solution you found out regarding tmp files? Please help! Link to comment Share on other sites More sharing options...
MaXi32 Posted November 8, 2022 Share Posted November 8, 2022 Just to save time for everybody else, the above discussion are not for prestashop 1.7. You can find the PHP controller at: controller/admin/AdminImportController.php Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now