Hi,

I need to convert (store) attached images to imagefield for CCK (the image sizes etc will be the same as old attached). So basically I'd like to get the logic how imagefield creates db fields to store files (to create it manually or via some small script).

Any leads are appreciated.

Comments

ablewave’s picture

Hi there,

Did you ever get this issue solved? I think I have a similar problem, and would love to know what approach you took:
http://drupal.org/node/658376

thanks!

soupp’s picture

I just manually manipulated database. It was pretty easy even with a couple of thousand images.

What I did:
- created new SQL query with NID + FID + file name
- exported it to csv then edited in some spreadsheet to match CCK field (good idea to create a couple of nodes with imagefield to see db schema)
- imported ready csv back to database

But some kind of script would work easier / faster of course.

ablewave’s picture

Thanks Soupp,

Is the node_(contenttype) table the only other table involved? So if I have these files spread across 3 file types, I need to do some data work and do 3 imports, correct?

soupp’s picture

Exactly. Your FID (from "files" table, which probably you don't have to touch) should go to say: table "content_type_mytype" to field "field_myimage_fid" for matching NID.

Something like this.