ReadImageFile
Requires Analytica Enterprise or Power Player
ReadImageFile(filename, showDialog)
Reads an image file with «filename» into memory and returns a value that acts as a handle to the image and can be assigned to the Pict attribute of an object on a diagram.
The optional parameter, «showDialog» controls whether the file dialog appears. If not specified, then the dialog appears only if the file does not exist. To prevent this from showing (displaying an error instead) specify «showDialog» as False
. To force the dialog to display, even if the file exists (i.e., as a way to give the user a chance to change the filename, while still providing a default name), specify «showDialog» as true.
From ADE, the dialog is never displayed.
Uses
We foresee possible cases where certain applications may need to integrate with an external application that generates an image, and then may want to embed the image in a diagram. Analytica might launch the external command using RunConsoleProcess, sending it commands and data either through stdIn or via a data file, and waiting for it to complete. The external program would produce an image (e.g., a JPEG) and store it in a file. Analytica would then use ReadImageFile to read in the resulting, dynamically created, image and assign it to the Pict attribute of a picture node on the diagram. To update the dynamic image, it would repeat the process.
External processes that might be used in the fashion might include GIS systems, drawing programs, or external graphing engines.
This reads the image only from a file on disk. To read an image from a web URL, use ReadFromURL. There is also no facility currently for extracting "blobs" from database queries and converting them to functional image objects.
Image handles currently display in result tables in a textual form. This is also tentative and subject to change, with the possibility that future releases will display the graphical image directly in the result table.
Supported file formats
- JPG, JPEG
- PNG
- GIF
- TIFF
- EXIF
- WMF
- BMP (in Analytica 5.1 or later)
From ADE
When evaluated in the Analytica Decision Engine (ADE) and a dialog needs to be shown to the end-user, it calls IAdeUICallbacks::GetFilename(...). From within that callback, the parent application can interact with the end-user to resolve the file path, and a web applications can instruct the end-user to upload a file. Once complete, the callback returns the full path to the file which is then read. To receive this callback, the parent application must have previously registered the callback with ADE using CAEngine::SetCallbackObject( ). If it has not registered a callback and the file doesn't exist, returns an empty text.
History
Introduced in Analytica 4.2 as an experimental feature.
ADE callback added in ADE 4.6
Promoted to supported function in Analytica 5.0.
Enable comment auto-refresher