English 中文(简体)
Filemaker GetAs...How to display Container Field on webpage?
原标题:

I have an ASP.Net application that needs to display an image that is stored in a Filemaker Container field. My query statement looks like:

SELECT GetAs(Image,  JPG ) FROM UA_Item_Pictures WHERE "Stock Number" = 33989 AND ImageOrder = 1

According to the documentation: The possible file types (case sensitive) you can retrieve from a container field in a FileMaker database file are:

EMBO OLE container data

PDF Portable Document Format

EMF+ Windows Enhanced Metafile Plus

PICT Mac OS (does not have 512-byte file-based header)

EPS Embedded PostScript

PNGf Bitmap image format

FILE Result of an Insert File command

PNTG MacPaint

FPix Flash (FPX)

qtif QuickTime image file

FORK Resource fork (Mac OS)

.SGI Generic bitmap format

GIFf Graphics Interchange Format

snd Standard sound (Mac OS raw format)

JPEG Photographic images

TIFF Raster file format for digital images

JP2 JPEG 2000

TPIC Targa

META Windows Metafile (enhanced)

XMLO Layout objects

METO Windows Metafile (original)

8BPS PhotoShop (PSD)

moov Old QuickTime format (Mac OS)

So with this information, my questions are:

  1. How do I retrieve contents with multiple formats?
  2. How do I render the BLOG into an image on the page?

Any suggestions would be much appreciated!

问题回答

Thanks, but I think I found out what was going on. If I did an inner join between an image table and another table, the image wasn t being returned (or being returned properly...not sure which). As soon as I ran a query against the image table directly, images were returned.

So this did not work: select * from biography_table b inner join image_table i on b.stocknumber = i.stocknumber where b.stocknumber = 12345

But this does: select * from image_table where stocknumber = 12345

This means I have to run 2 separate queries, but at least I m seeing data!!

If you cannot predict what the file type will be, AND/OR you need to use other extensions (such as docx, xlsx, etc), then you can exclusively use FILE for all of your storage and retrieval scripts.

However doing it this way means that FileMaker does not know natively how to handle and open the file. In other words, when using FileMaker you will need to manually export the contents of the field to edit/view it, instead of being able to simply double click the field and it opens the file. So either the setup is advantageous to FileMaker, or advantageous to your external application.

If you do it this way, all files in container fields will be called Untitled.dat and their internal name will be ? , so you will also need to store in another field the actual file name or its extension so you can open it later.

It is because you are using JPG instead of JPEG, in fact, your question answers itself. You can read it this way

SELECT GetAs(Image,  JPEG ) ...

And then, if you are using ado.net read it this way

var bytesLength = reader.GetBytes(0, 0, null, 0, 0);
var buffer = new Byte[bytesLength];
var bytes = reader.GetBytes(0, 0, buffer, 0, (int)bytesLength);
using (var fileStream = new FileStream(String.Format("{0}.jpg", Guid.NewGuid().ToString()), FileMode.Create, FileAccess.Write)) {
    fileStream.Write(buffer, 0, buffer.Length);
}

Where 0 at the beggining of the the GetBytes function is the index of the photo field.

Buy a license of SuperContainer (shameless plug alert: I m one of the authors) and a Mac Mini to host it on. Move the files out of your container fields and into SuperContainer, and let SuperContainer render image versions of your files by tapping into OS X s CoreImage libs.





相关问题
Add 2 extra columns to an excel file

Since the Microsoft ODBC Excel Driver doesn t support ALTER TABLE/DELETE FROM(/UPDATE?) statements, I m using alternative ways of getting the right data in the right place. I still have one problem ...

Tracking SQL Calls From MS Access to MySQL

I m trying to see the SQL statements that are sent from MS Access 2003 to MySQL via ODBC. I ve tried ODBC Tracing, but it s painfully slow, producing very large log files which are very difficult ...

Update Array field in progress DB using ODBC

I access the progress DB using ODBC in my C# program, and I need to update some fields,which are array data type. so how can I write my sql statement to do such things? I read some progress ...

CakePHP and connecting to MS Access db using Unixodbc

I m trying to use an Acces (MDB) database from a CakePHP app. On a Windows machine this works fine. On a Linux machine using Unixodbc this doesn t work at all. The error is as follows: Warning (2): ...

Connecting to Oracle 10g with ODBC from Excel VBA

The following code works. the connection opens fine but recordset.recordCount always returns -1 when there is data in the table. ANd If I try to call any methods/properties on recordset it crashes ...

Filemaker GetAs...How to display Container Field on webpage?

I have an ASP.Net application that needs to display an image that is stored in a Filemaker Container field. My query statement looks like: SELECT GetAs(Image, JPG ) FROM UA_Item_Pictures WHERE "...

Informix ODBC Connection Help

I have a development project that requires us to be able to support informix data sources via ODBC. I ve downloaded the prebuilt Informix Virtual Appliance from the IBM website and am able see the ...

热门标签