Images

4 posts by 2 authors in: Forums > CMS Builder
Last Post: February 10, 2012   (RSS)

By design9 - February 9, 2012

I am importing in some data from an old CMS we used to have to CMS builder. The listings in the old CMS had images attached that were stored in a specific folder. Is there any easy way to link them all back up in CMS builder after I have imported the data so I do not have to go and put them back in seperately? I can still use the folder they are still stored in or copy to a new folder.

Thanks!

April

Re: [design9] Images

By (Deleted User) - February 9, 2012

Hi April,

The short answer is there isn't an easy way, but there are ways that aren't too difficult.

CMSB uses a central uploads table to store image locations and associations with records and fields within those records.

You could create a script to add the information to the uploads table but you'd have to know which image goes with what record num in the new table structure (which you could find out if you knew some other unique factor of the record to associate the image with).

If you wanted to use the current directory for the images you will have to set the uploads directory in General Settings to that directory OR set a specific upload directory for that field in CMSB (Admin->Section Editors->{SECTION}->{FIELD}->Advanced Options->Upload Directory which would then mean any new uploads for that field would be added to that specific directory but other uploads would be put in the General Settings uploads directory.

The more laborious method is to simply go record by record, manually adding them.

Let me know if this helps,

Tom

Re: [design9] Images

By (Deleted User) - February 10, 2012

Hi April,

Importing the data first without the image/uploads is fine. The next step would be to create a CSV of recordnums, the fieldname the files are being uploaded to, the tablename and the image filenames:
recordnum,table,field,image
1,records,uploads,image001.jpg
1,records,uploads,image002.jpg
1,records,uploads,image003.jpg
2,records,uploads,image004.jpg
2,records,uploads,image005.jpg
3,records,uploads,image006.jpg
4,records,uploads,image007.jpg


In the above we're adding the images to the field 'uploads' in the table 'records'. This assumes all the images are in the same directory.

Creating the script is something that would take a bit more time and space than we have available in the forum - if you aren't comfortable trying it yourself we could look at building one for you but that would be more of a consulting request than a help request.

If you'd like to ask for a quote, you can email consulting@interactivetools.com with the details (just include a link to this thread).

Of course, if someone has already written a function to do this then let us know!

Let me know if this helps,

Tom