Insert images into the database

-1

Good afternoon, I inserted a large amount of information into a table in my database through a .csv file using the LOAD DATA INFILE command line, and I also have a relationship table where the product ID is recorded and the path of the photo (s) of that product, but I'm trying to escape having to register the photos manually, in this case, uploading the photo (s) by a form in my administrative area. I know it sounds magical but is there any way I can do this, relate the product to images in a folder and save the path in the table, or has anyone had a situation like this?

    
asked by anonymous 07.10.2014 / 19:14

1 answer

3

Yes.

Put the photos on your computer preserving the folder structure and make a robot (it can be a php) that makes a full table scan (that is, a select all and a loop in that result) looking for the photo of each product. If the photo is found, update it in a new column (photo found), rename the photo to the product id and move it to a common folder.

Then just upload all the photos via an ftp.

    
07.10.2014 / 19:22