For security reasons a file embedded in your EXE can't be accessed by an external library, such as FoxyPreviewer3. That means that FP3 can't deal with the images in your reports when you run the reports from your EXE. We still save some options to deal with that:
OPTION #1 - Store the image files outside your EXE, in a drive location, that can be passed with the full address, so that FoxyPreviewer.App can "see" these files and include them in your desired output.
OPTION #2 - To make these images appear automatically, without the need of removing the image files from your project.
- Include the program "FOXYGETIMAGE.PRG" in your EXE project. This file is found at the main folder of FoxyPreviewer. This file will provide access to FoxyPreviewer (and any other VFP program) to get the needed images from the executable. Please note that this may bring some security issues to your EXE, because this program will allow FoxyPreviewer and other programs to access the embedded images of your EXE. I recommend you to open this file, and analyze it. You can make any changes you find necessary to it, for example to make it allow only some specific files to be accessed. Right now, FOXYGETIMAGE.PRG allows accessing only image files, with the extensions: "BMP", "GIF", "PNG", "JPG", "JPEG", "TIFF", "TIF", "EMF".
- Set the new property: _Screen.oFoxyPreviewer.nSearchImgMode = 2 or 3 - That's an additional setting to tell FP3 to turn on or off this setting. That is to avoid an unnecessary process, forcing VFP to search in the disk for a file that is already available. This can slow down a little the report run. Behind the scenes, FP3 will store the image files at the FP_IMAGES\TEMP folder during the report run. These files will be deleted immediately after the report is rendered.
Below is the file FOXYGETIMAGE.PRG contents:
* PROCEDURE FoxyGetImage.prg * To be used with FP3 if you use embedded images in your EXE * Retrieves image files embedded in the main EXE * To be included in the main VFP EXE project. This may bring security issues - use at our own risk LPARAMETERS tcImageFile, tlTempFile LOCAL lcPictVal, lcReturn m.lcPictVal = "" IF INLIST(UPPER(JUSTEXT(m.tcImageFile)), "BMP", "GIF", "PNG", "JPG", "JPEG", "TIFF", "TIF", "EMF") TRY m.lcPictVal = FILETOSTR(m.tcImageFile) CATCH ENDTRY ENDIF IF m.tlTempFile AND NOT EMPTY(m.lcPictVal) && Store in a TempFile in disk LOCAL lcTempFile, lcTempPath IF PEMSTATUS(_Screen, "_FoxyTempImagesPath", 5) lcFolder = _Screen._FoxyTempImagesPath ELSE lcFolder = SYS(2023) ENDIF m.lcTempFile = ADDBS(lcFolder) + JUSTFNAME(m.tcImageFile) STRTOFILE(m.lcPictVal, m.lcTempFile) m.lcReturn = m.lcTempFile ELSE m.lcReturn = m.lcPictVal ENDIF RETURN m.lcReturn
No comments:
Post a Comment