Home

Cardbox Talk

 

CardboxForumsCardbox Talk > "Read location of photo and insert thumbnail"

Read location of photo and insert thumbnail

Current user: [none]
Register / Log In · Help

Posted By Post

Foster

25-Jan-2013 00:54

I work in a small registered charity which looks after original newspapers, historical documents and about 25K historical photos. We have until now been using MS Access to store details of the photographs but now essential cost of upgrades to Access would bankrupt us. Recently discovered CB and very impressed – why didn’t we find it before?
Build CB application from data in Access using export as csv and importing into CB. All went well and working. Now would like to develop a macro to populate CB with thumbnails of the photos. The full path to each thumbnail is stored within CB as a text field.
Have tried many variations to read the full path to the thumbnail image from the field, and paste thumbnail into the relevant image field. Tried bulk import and split but would need to re-enter a bunch of data into the new records created.
Would really appreciate any hints.

Charles Welling

25-Jan-2013 09:13

You could use the following macro. It uses not the fastest method, but the method that is most easily understood as it reproduces the keystrokes you would use yourself.
The first and the last line make it loop through your selection.
It starts editing the record. Assuming that the field that contains the filename is called FILENAME, it takes the filename fromthat field and adds the image to the existing images in the record. If there are none present, the newly added image will be the first.
It then saves the record and moves on to the next until it runs out of records.

The macro section of the helpfile has some good examples. You could have a look at ReadFromFile (images).

for counter = 1 to RecordCount
editrecord
set imgs = ActiveRecord.Images
imgs.ReadFromFile Fields("FILENAME")
saverecord
nextrecord
next

Foster

25-Jan-2013 10:58

Charles. I am very grateful. Indeed as you mention it is a bit slow but as it is a one off - who cares? Thanks very much for your advice

Quick Reply

Please log in or register before trying to post a reply.

 
© 2010 Cardbox Software Limited   Home