I manually uploaded an image for a product. It shows up on the product page. I see that it created the image file in Content\Images as

0000002_0.jpeg

And in the Thumbs subfolder.

I see the record in the [Picture] table but there are no records in the [Product_Picture_Mapping] table. Also the PictureId in the [Product] and [ProductVariant] tables for that product are 0. I see that the PictureID is part of the image name but how is it relating it to the product? I'm missing something.

I need to write an image uploader to assign a few hundred images to products I've already imported.

Dan