Jump to content

Export jpgs and re-import


This topic is 6199 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Hi,

here's my dilemma. We have a database that contains approximately 1500 images in high resolution. The images are embedded (not linked). What I would like to do is this:

loop through records

export the jpgs into one specific folder

name the jpgs depending on three fields in the current record

(I will then batch process all images and resize them)

re-import the images (but link them this time)

In theory, that sounds great, but how do I get the raw jpg out of the FM record? and can I assign a filename to it?

thanks

SM

Link to comment
Share on other sites

And, while you're on the record during the Loop, you could Insert Picture [ As reference only ] using a FileMaker syntax $imagepath. That is, Export embedded and Import as reference within the same Loop. You could put it right back into the container field. You'd want to have a backup of the file however, in case something went wrong.

Right after the Export Field Contents step:

Set Variable [ $ImagePath; Value:"imagemac:" & Get ( DesktopPath ) & "/ExportedFolder/" & Table::SerialID & ".jpg" ]

Go To Field [ Table::ImageField ]

Insert Picture [ As reference only; "$ImagePath" ]

Commit Record

Link to comment
Share on other sites

Excellent .. well, I am splitting the script into two, an import and an export part because i want to resize them all as well .. I use an external application for that ..

Another question though, how do I display a thumbnail in my container field that automatically links to the large version of the same file? Is this automated in FM or do I have to build that myself?

Link to comment
Share on other sites

Ah, yes, you said that you were resizing them. It would be possible to resize them using AppleScript and Image Events, then insert the resulting file(s) back. Or, as you said, a separate operation with an external application.

To get them back:

1. Show All Records, then Import Folder, with Matching Records, based on a unique file name.

or

2. Loop again, using a script Variable for the path to Insert Picture [ Reference ]

#1 above can create a 128x128 thumbnail on the fly while importing; which it would EMBED into FileMaker (not as a reference). You'd need a container field for it. Otherwise, yes, you'd need to create the thumbnails yourself, likely with your external app.

Link to comment
Share on other sites

Hey Fenton, yeah, that import based on matching records is giving me a little grief .. as mentioned, I have a few fields that contain text data (year, building, room, fumehood number). I created a calculation that puts all these in a string ( using getastext()) .. that's how I assign the filenames for the jpgs anyways ..

When trying to re-import, it won't let me match the filename (of the photo) with that calculation field .. maybe because it is a calculation?

thanks for your help

Link to comment
Share on other sites

At first the field is grayed out, then, when you click once on it, it is crossed out (red). But if you click again on it, they symbol will change to an equal sign, =, and it should work. You have to use the (•) "Update matching records in found set" option. And you must Show All Records first; or else there's nothing to match to. Try it.

Link to comment
Share on other sites

seems to work .. thanks Fenton ...

I'm sure I'll have more questions as this goes on, but export, resize, import has worked beautifully so far .. database is from 580MB to 1.2MB .. sweet .. :)

Link to comment
Share on other sites

So, I got the database reduced, the pictures are resized and linked to the database, all is great, but now I want to host it on our filemaker server. The problem I have right now is that we do not run the FM client on our server computer, which means I can not open the database on the server and re-import the images. Also, the image folder will be stored on a second server. So, the database will be hosted from one computer (filemaker server) and the linked photos will reside on the second server.

Is there a way to find/replace the link to the pictures in all records? I tried the find/replace function, but it is not allowed on container fields ..

Right now my link looks something like this:

image://///Photos/

I'm guessing that my final link will look something along the lines of:

image://////Photos/

But I'm not sure what the best way to do this is. As I said, I have to reconfigure the database file on one computer, anticipating the final link, then transfer the database to the FM server and test it ..

How do I reassign this link?

cheers,

SM

Link to comment
Share on other sites

Take a look at this recent discussion:

http://www.fmforums.com/forum/showtopic.php?tid/186123/post/247927/hl//

But I'm not quite getting the problem. If you imported the images while they were in their final destination on the file server machine (not the FileMaker Server machine), then hosting the FileMaker files on FileMaker Server should make no difference. The FileMaker Server does not resolve the image path, the FileMaker client machine does. At least that's my understanding.

Link to comment
Share on other sites

Interesting .. I will look into that .. although I did not import those pictures from their final destination, but, unfortunately from my desktop .. I might just redo it and see how it goes ..

thanks again, learned a lot in the last 2 days! :)

Link to comment
Share on other sites

OK, I'm going to upload it again, modified. There are 2 layouts. The "Image" layout is for Inserting an image, as reference only. Then you can see what the file path looks like, in the _ImageInfo field. Copy the last value, the path.

Go to the _cImage layout. Paste the path into the FilePath field. You should then see the image in the _cImage field.

So you're looking at the same file, but with 2 different methods.

ImageAbsolutePath.fp7.zip

Link to comment
Share on other sites

thanks .. I think my problem lies in what you assume I know .. I don't even know exactly I'm supposed to test your file. How do I insert the test image? into what field?

Assuming I have a jpg on my desktop, I start up your file. What do I do next?

I'm sorry for going back to the basics here ..

cheers,

SM

Link to comment
Share on other sites

Put your cursor in the Image field, on the Image layout (not _cImage, 'cause it's a calculation), then, in the Menu Bar, Insert, Insert Picture, [x] As reference only.

That will let you see what the file path is.

Link to comment
Share on other sites

  • 2 weeks later...

Hi,

I have a question regarding referenced image. Does referenced image work when the db files are on the FM server?

Let say that the reference is c:imageimage001.jpg on the server. How the FM client will react? Will they check on their local path?

Thank you

Link to comment
Share on other sites

This topic is 6199 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.