Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Exporting images taken from databases?

Featured Replies

Okay, this might be a little bit complicated. I'm trying to save an image taking from a container field to my local disk. I know it's possible to save a picture to a specific location with PHP but I can't pull it off with a URL that gets an image from the FileMaker database.

That's because I need to insert this pic into a PDF created with TCPDF and TCPDF requires perfect HTML in order to work, meaning calling image.php? makes it fail and tell me image.php? isn't a picture.(I know it's not the exact line).

Now I can't really save the pictures locally and just put a reference to it in the database because the picture in this field can be modified by my clients, and it's important to me that if they change it, the next time they log in my web module, the image on the local will take the last one's place.

The following will read the image from Filmaker and write a local copy on the fly. I'm assuming image.php is a standard "container bridge" file and RecID is the only parm required to produce a single image from the database. Still, depending on your requirements this could become more trouble than it's worth (see below).


$imgpath = "http://server/path/image.php?RecID=" .$_GET['RecID'];

$img_h = curl_init($imgpath);

curl_setopt($img_h, CURLOPT_RETURNTRANSFER, true);

$imgString = curl_exec($img_h);

$info = curl_getinfo($img_h);

$fh = fopen("./img/img" . $_GET['RecID'] . ".jpg", "w" );

fwrite($fh, $imgString);

curl_close($img_h);

fclose($fh)

The first potential problems that come to mind are large images and several simultaneous hits, but that could hose your PDF gen as well.

As coded it only works with jpegs you can parse out the mime type included in $info['content_type'] to alter the file extension if you want to open it up other image file types, but given that FMP will take just about anything you may still run into trouble.

  • 3 weeks later...
  • Author

Well I eventually managed to pulled it off without coming back here and kind of forgot about this thread, but we ended up dropping that for storing the name of the various image on the database and loading the image from the local disk.

(So let's say the database outputs that the database needs to picture 1, 4 and 8, I have about 24 images all number-named to fit what's on the database.

Create an account or sign in to comment

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.