I have an app done for somebody else where photos shown on form
and report. I have never got this, myself but the client
sometimes reports strange image titles included with the image.
For example it would show or print the image and right underneath
it it would print the name of the image file.

--------
| |
| |
|(Image) |
| |
| |
| |
--------
Logo.bmp

Anybody seen this and a solution?

-----------------------------------------------------------------
Paul Lee ........... Abri Technologies ......... http://abri.com/
'Recover' - top rated FoxPro file repair utility.
-----------------------------------------------------------------

Re: Image name with image oddity on forms and reports. by Dan

Dan
Fri Aug 19 15:57:48 CDT 2005

How are the images stored?

If they're in general fields, there's not much you can do about it. Fox
doesn't display them. The application registered for that data type displays
them, and they decide what/how to display.

Dan

Paul Lee wrote:
> I have an app done for somebody else where photos shown on form
> and report. I have never got this, myself but the client
> sometimes reports strange image titles included with the image.
> For example it would show or print the image and right underneath
> it it would print the name of the image file.
>
> --------
>> |
>> |
>> (Image) |
>> |
>> |
>> |
> --------
> Logo.bmp
>
> Anybody seen this and a solution?
>
> -----------------------------------------------------------------
> Paul Lee ........... Abri Technologies ......... http://abri.com/
> 'Recover' - top rated FoxPro file repair utility.
> -----------------------------------------------------------------



Re: Image name with image oddity on forms and reports. by Leemi

Leemi
Fri Aug 19 16:30:38 CDT 2005

Hi Paul:

I assume the images are in general fields, correct? If so, you need to get
them into actual image files and then display them. Here is a code example
for use with forms and reports.

Fox is at the mercy of external applications for the display of items
embedded in general fields. This would be true no matter what type of file
it is (Excel Worksheet, bitmap, jpg, etc). Going forward, your app needs to
have a more encapsulated way of dealing with this. Following is just such a
method.


REPORT
---------------
By using the MEMO BINARY field type and a UDF(), we can store .JPG files in
a table field yet when the report runs have them read from DISK. Here's how:

(1) Create a table or cursor with a structure like this (plus any added
fields as necessary)

FileName C (150)
MemBin MEMO(BINARY)

The command would be CREATE TABLE GENDBF (FileName c(150), MemoBin M
NOCPTRANS)

(2) Append .JPGs file into the MEMO(Binary) field using FILETOSTR() and set
the filename field accordingly. For instance:

INSERT INTO CURSORNAME VALUES("ToothBrush.JPG", FILETOSTR(<PathToFile>))

(3) The FoxPro report will still need an OLEBOUND control on it to print
pictures, but instead of pointing the OLEBOUND to a general field, point it
FILE and use this as the expression:

MYUDF(FileName, MemoBin)

Where MyUDF is in some program made available via SET PROC and reads thusly:

PROCEDURE MYUDF(lpFileName, lpMemoBinFld)
LOCAL lcTemp as String
lcTemp = ADDBS(SYS(2023)) + "JPGTEMP\"
IF !DIRECTORY(lcTemp)
MD (lcTemp)
ENDIF
SET SAFETY OFF
STRTOFILE(lpMemoBinFld, lcTemp + lpFileName)
SET SAFETY ON
RETURN lcTemp + lpFileName

(4) Finally, preview/print the report. You may also want to fire some lines
like this to clean up afterward:

ERASE ADDBS(SYS(2023)) + "JPGTEMP\*.jpg"
RD ADDBS(SYS(2023)) + "JPGTEMP"

The .PRG uses the code above and the .JPGs that come with W2K, so it should
run on that OS with no problem.

----------------------------------------------------------------------------
---



FORM
----------
Let's assume we have the table created earlier:

FileName C (150)
MemBin MEMO(BINARY)

This form will display images from it:

PUBLIC oform1

oform1=NEWOBJECT("form1")
oform1.Show
RETURN


**************************************************
DEFINE CLASS form1 AS form
Top = 71
Left = 48
Height = 310
Width = 504
Caption = "Fox Image Demo"
Name = "Form1"

ADD OBJECT image1 AS image WITH ;
Height = 296, ;
Left = 3, ;
Top = 8, ;
Width = 381, ;
Name = "Image1"

ADD OBJECT cmdPrevious AS commandbutton WITH ;
Top = 27, ;
Left = 422, ;
Height = 27, ;
Width = 24, ;
Caption = "<", ;
Name = "cmdPrevious"

ADD OBJECT cmdNext AS commandbutton WITH ;
Top = 27, ;
Left = 446, ;
Height = 27, ;
Width = 24, ;
Caption = ">", ;
Name = "cmdNext"

ADD OBJECT cmdQuit AS commandbutton WITH ;
Top = 72, ;
Left = 405, ;
Height = 27, ;
Width = 84, ;
Caption = "Quit", ;
Name = "cmdQuit"

PROCEDURE getimage
LPARAMETERS lpFileName, lpMemoBinFld

LOCAL lcTemp AS STRING
lcTemp = ADDBS(SYS(2023)) + "JPGTEMP\"
IF !DIRECTORY(lcTemp)
MD (lcTemp)
ENDIF
SET SAFETY OFF
STRTOFILE(lpMemoBinFld, lcTemp + lpFileName)
SET SAFETY ON
RETURN lcTemp + lpFileName
ENDPROC

PROCEDURE Destroy
USE IN SELECT("PICTURES")
ERASE ADDBS(SYS(2023)) + "JPGTEMP\*.jpg"
RD ADDBS(SYS(2023)) + "JPGTEMP"
ENDPROC

PROCEDURE Load
CD JUSTPATH(SUBSTR(SYS(16),AT(' ',SYS(16),2)))
USE PICTURES
ENDPROC

PROCEDURE Init
THISFORM.Image1.Picture = ;
THIS.GetImage(Pictures.FileName, Pictures.MemBin)
ENDPROC

PROCEDURE cmdPrevious.Click
IF RECNO() <> 1
SKIP -1
THISFORM.Image1.Picture = ;
THISFORM.GetImage(Pictures.FileName, Pictures.MemBin)
THISFORM.REFRESH
ENDIF
ENDPROC

PROCEDURE cmdNext.Click
IF RECCOUNT() <> RECNO() AND !EOF()
SKIP
THISFORM.Image1.Picture = ;
THISFORM.GetImage(Pictures.FileName, Pictures.MemBin)
THISFORM.REFRESH
ENDIF
ENDPROC

PROCEDURE cmdQuit.Click
THISFORM.RELEASE
ENDPROC
ENDDEFINE
**************************************************
I hope this helps.

This posting is provided "AS IS" with no warranties, and confers no rights.

Sincerely,
Microsoft FoxPro Technical Support
Lee Mitchell

*-- VFP9 HAS ARRIVED!! --*
Read about all the new features of VFP9 here:
http://msdn.microsoft.com/vfoxpro/

*--Purchase VFP 9.0 here:
http://www.microsoft.com/PRODUCTS/info/product.aspx?view=22&pcid=54787e64-52
69-4500-8bf2-3f06689f4ab3&type=ovr

Keep an eye on the product lifecycle for Visual FoxPro here:
http://support.microsoft.com/gp/lifeselectindex
- VFP5 Mainstream Support retired June 30th, 2003
- VFP6 Mainstream Support retired Sept. 30th, 2003

>How are the images stored?

>If they're in general fields, there's not much you can do about it. Fox
>doesn't display them. The application registered for that data type
displays
>them, and they decide what/how to display.

>Dan

>Paul Lee wrote:
> I have an app done for somebody else where photos shown on form
> and report. I have never got this, myself but the client
> sometimes reports strange image titles included with the image.
> For example it would show or print the image and right underneath
> it it would print the name of the image file.
>
> --------
>> |
>> |
>> (Image) |
>> |
>> |
>> |
> --------
> Logo.bmp
>
> Anybody seen this and a solution?
>
> -----------------------------------------------------------------
> Paul Lee ........... Abri Technologies ......... http://abri.com/
> 'Recover' - top rated FoxPro file repair utility.
> -----------------------------------------------------------------