Insert images into database

Asked

Viewed 139 times

-1

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

  • This sounds magical... :| Where does the information have which image is of which product?

  • Hello @Kaduamaral was precisely why I posted here, to know if anyone has any tips on how to do this, I tried some possibilities but without success.

  • if you have the product id and the photo path of each product is just make the robot below.

  • 1

    Hello @lolol, that’s exactly what I did, I created a robot as indicated, it was very cool.

1 answer

3


Yes.

Place the photos on your computer preserving the folder structure and make a robot (can be a php) that does a full table scan (ie a select all and a loop in this result) looking for the photo of each product. If the photo is found update 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 through an ftp.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.