I found the order of importing images during AdminImport. (/admin/tabs/AdminImport.php)
When importing a CSV, the image(s) gets checked & uploaded by this function (from line 719)
if (isset($product->image) AND is_array($product->image) and sizeof($product->image))
{
$productHasImages = (bool)Image::getImages(intval($cookie->id_lang), intval($product->id));
foreach ($product->image AS $key => $url)
if (!empty($url))
etc etc etc
This code will trigger the copyImg code :
{
if (!self::copyImg($product->id, $image->id, $url))
$this->_warnings[] = Tools::displayError('Error copying image: ').$url;
}The copyImg function is also found in the same file on line 374.
This will upload the image and resize it. But it does not check if there are already images. So i added some code that calls the function deleteImage (that is in images.inc.php on line 251.
The new code looks then like this :
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
I tried it but it will not delete the existing image...
Have to dig further. Any clues?
Was your post not answered? Don't fret but DO give more info.. Some threads are so unclear that an answer will never come.
For hire for Prestashop customizations and iDeal integration