Binary result, filename and preview error

1 message Options
Embed this post
Permalink
schulz_b

Binary result, filename and preview error

Reply Threaded More More options
Print post
Permalink
Hello!

How do you solve this problem:
With FM 8, FM9 & FM 10, when your plug-in returns binary data (an image) WITHOUT filename, the image is displayed in a FileMaker container field.

But as soon as a filename is provided, I get "The file cannot be displayed: test.jpg" in the container field.

(But when I export the image with a right click on it and the FileMaker command "Export field Contents..." I can see that the image is fine (with Apple Preview for example).)

Example-Code (without error handling, only necessary lines):
########
        fmx::TextAutoPtr resultTxt;
        fmx::BinaryDataAutoPtr binData;
        char filename[] = "test.jpg\0";
       
        // ...
       
        resultTxt->Assign(filename);
        binData->AddFNAMData(*resultTxt);
        char binType[5] = "JPEG";
        fmx::QuadCharAutoPtr binFmType(binType[0], binType[1], binType[2], binType[3]);
        binData->Add(*binFmType, size, (void*)serverresult);
        results.SetBinaryData(*binData);
########


All hints are very welcome!

Thank you,
Bernhard Schulz