Jump to content

[Bug] Ps Csv Import: External Images


Recommended Posts


at the moment seems that there's no way to correctly import/update external images into Prestashop




My csv is correct, images are all in place, are there if you go to the source


Product ID;Reference;Name;URL Images

"243";"90-C1SFE0-00";"PIKE 2108-32PD";"http://images.othersite.com/img/gallery/16713_7575276_6973.jpg,http://images.othersite.com/img/gallery/16713_7575276_5980.jpg,http://images.othersite.com/img/gallery/16713_7575276_1703.jpg"

I tried with a few lines (about 60 lines)


always returning with some:

I also tried with PHP memory unlimited...that's not the issue.


So, this is a bug since a long time ('cause I saw many posts about this, since 2013 but even before...)

How is possible that they don't fix this ...?

How possible that, even if it worked by local path (as someone states...), we're force to first download images and then import them? And I'm not even sure that it works on local path at the moment....


Edited by mmsh (see edit history)
Link to comment
Share on other sites

I think that there's something wrong on AdminImportController.php function copyImg on line 1025

protected static function copyImg (...)

next week I will check but probably I will send a bug on Forge... 'cause it's time to fix this issue once for all  ;)

Link to comment
Share on other sites

I don't think you can import images from a subdomain. You have to enter a temp directory url of your shops' root directory.

thank you for your comment, which is really meaningful  ;)


you know... "think"

there should be a document about this, we should not guess what kind of URL goes there...

couldn't the import do a simple image download?

suppliers sometimes don't provide images, sometimes provide their URL  :D 

a developer can't "think" we have to first manually download the images of so many products and then... ... ..

Edited by mmsh (see edit history)
Link to comment
Share on other sites

on the PS document:



it doesn't mean anything.... it's not clearly stated that the URL must be on local server only...

Edited by mmsh (see edit history)
Link to comment
Share on other sites

and not only, I tried with an external URL and it worked... but it worked for one line only during my test... when the lines are more, instead, the behavior is unpredictable


precisely because the routine is not well done, probably there's not a verification about the "download complete" and because of this... that function returns errors...AND It's not the end of the story...also, when it returns errors about copy, besides the fact that is not clear WHAT was wrong, it doesn't complete even the others...it stops and enough...

it doesn't report eg. that ONE OF THEM failed and why... (in order to retry for the specific lines...) but it doesn't import anything...



bad, bad, bad, bad :-D 

Edited by mmsh (see edit history)
Link to comment
Share on other sites

this issue at the moment is there... and I have no time to fix that, because studying and fixing that code is more time consuming that developing it from scratch 


by default it works fine just by local path, with the format:



So, unfortunately had to do my personal script in order to first download images and then write their URLs on a .csv to import later...


then, the Admin Import often returns "EMPTY RESPONSE" if there are many lines to import, even if the process on server correctly ends

so it doesn't seem to be a server issue... but I don't know what's the cause, if the Chrome window or other...

Edited by mmsh (see edit history)
Link to comment
Share on other sites

well, the empty response seems to be related to the Google DNS...

when I changed DNS to those ones provided by my ISP... it didn't happen anymore  ;)

anyway, when I have time...if no one from PS replies here, I will try to contact someone on Github or write on Forge...

Link to comment
Share on other sites

  • 2 weeks later...

update: the empty response happens despite of the DNS...


no errors on log, I can see that it correctly runs the script by the access log...


because of many lines about ...GET /myfolder/download/img/filename.jpg HTTP/1.0"


the script works but you can't always see the correct response by browser


so I think they should find another more efficient method to do the import, maybe by cron....

setting a configuration with the file to import, the delimiters and so on...

and let the user run it by cron (and CLI)... at least for dedicated servers

Edited by mmsh (see edit history)
Link to comment
Share on other sites

or... in addition to this


splitting the file and make a realtime output


eg. any 100 lines

write first 100 rows imported...

other 100 rows imported...


and so on...


p.s.: script executed in 22 minutes to update 3757 products with images (but the problem for empty response remains)

Edited by mmsh (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...

Hello. Did anyone find a solution for this issue because I am experiencing the same?




I am using Prestashop


I tried many suggestions:


1) changed the permission of the folder in cpanel

2)used image urls without dashes, underscores or other special characters

3) changed the Classes/Tools.php file replacing


"return @copy($source, $destination, $stream_context);"



"return @copy($source, $destination);"

4) I updated my Prestashop version

5)disabled and re-enabled mod security.

6) I also tried 5 different versions of prestashop believing that it was a version bug but all to no avail.



Could it be an external issue outside prestashop because I went back to PS 1.5.x.x and had the same issue? That should not happen because

 my image urls were uploading back then and on up to 1.6.0.x. Like a host or IP configuration issue?

Edited by thetechno (see edit history)
Link to comment
Share on other sites

there is no solution at the moment for external images... they should know about it


now you can only download the images where you need and then import by the format


 ...and so on...




better if you're sure that the images get httpcode 200 .. that is they are in place... otherwise the import stops with errors...

Edited by mmsh (see edit history)
Link to comment
Share on other sites

  • 2 weeks later...
  • 8 months later...

update: the import may return errors, but for images which are in place it works and the list is imported until the end...

anyway, also wrote on github...impossible that they don't know about it, maybe they don't consider it critical...and it's wrong


usually suppliers provide their image list, so download them on your server at first in a temp folder is a further, unwanted and avoidable step... 

unless the import script does it for you without further edit...


definitely, the import script is incomplete

Edited by mmsh (see edit history)
Link to comment
Share on other sites

  • 2 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...