2 replies [Last post]
justageek's picture
Offline
Bug Finder
Joined: 10/29/2008
Juice: 189
Was this information Helpful?

Hi, I'm doing a mass import in a conversion from an old cart to UC. I have the logic for grabbing data and creating my product nodes, but I have not yet figure out how to create multiple images per product. The images are on the file system of the server, so I can easily copy them to their final home in Drupal using PHP, I'm just not sure if I can create the image data properly in my code.

Anyone done something like this? Any pointers?

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: create product images programmatically

I have done this by using drupal_write_record() to add rows to files and content_field_image_cache tables. The content field table requires the fid from files as well as the nid and vid from the node table, so make sure you insert the records in order.

justageek's picture
Offline
Bug Finder
Joined: 10/29/2008
Juice: 189
so does this sound correct?

1. Create product node
2. Use php to copy image into drupal files folder
3. Create files db record
4. Create image_cache db record

are the images located in specific sub folders or all in one single folder in the drupal files home?