Good Afternoon All:
Thanks for all the good ideas in the many responses.
Since I developed this application in VFP 6 not all the arguments in the 
strconv are available. There are no base64 options.
So I found some great code in http://fox.wikis.com/wc.dll?Wiki~VfpBase64 that I 
used to convert the JPG to a base64 string.
I saved it in record 1 of the VCX in the user memo field (as suggested below). 
Then just before I added the vcx to the form I opened the vcx table and sent 
the base64 characters to the decoding section to save that as a JPG.
But it didn't work! Every time I tried to open the file and extract the memo 
field contents I received a file is in use error. I everything I know to close 
that VCX didn't work and it was still open. I issued a release classlib 
vcx_name and the response was the VCX does not exist. For the future, if 
someone knows how this could be accomplished it would be appreciated.
So I took the contents out of the VCX and placed it in a method of so that 
could be converted back and of course the line was too long. So I broke the 
string into 100 character segments end saved it in an array. I then built the 
string to send to the conversion and it worked. 
I don't understand the property constructs in the below code.
Regardless, it is working and it was very time consuming!
Thanks again!
Best regards,

Jack

________________________________________
From: ProfoxTech [[email protected]] on behalf of Thierry Nivelet 
[[email protected]]
Sent: Thursday, May 30, 2013 4:33 AM
To: [email protected]
Subject: Re: JPG file in a VCX

you could do this:

&& At design time
_cliptext = JustFname(yourImageFile) + '|' +
Strconv(FileToStr(yourImageFile),13) && encodes image contents into base64

IF Len(_cliptext) <= 8.192

     && paste into yourProperty in property window

     PROCEDURE yourProperty_access && in your class.vcx
     LOCAL lcFile
     lcFile = Addbs(Sys(2023) + GetWordNum(this.yourProperty, 1, '|'))
     RETURN Iif(StrToFile(Strconv(GetWordNum(this.yourProperty, 2, '|'),
14), m.lcFile) > 0; && decodes image contents from base64
         , m.lcFile; && image file address
         , .NULL.;
         )

ELSE

     && in IDE
     USE your.vcx
     LOCATE FOR objname = 'yourClass'
     REPLACE user WITH _cliptext

     && At runtime, when application starts:
     USE your.vcx NOUPDATE
     LOCATE FOR objname = 'yourClass'
     lcFile = Addbs(Sys(2023) + GetWordNum(User, 1, '|'))
     StrToFile(Strconv(GetWordNum(User, 2, '|'), 14), m.lcFile)
     USE

ENDIF

Thierry Nivelet
FoxInCloud
Give your VFP app a second life in the cloud
http://foxincloud.com/

Le 29/05/13 17:56, Jack Skelley a écrit :
> Good Morning All:
> I have a class library and was wondering if it is possible to embed a JPG so 
> a separate file does not need to be sent with the VCX.
> Currently I am entering the JPG's file spec from a directory in the 'picture' 
> construct.
> Thanks for any help.
> Regards,
>
> Jack
>
> Jack Skelley
> Senior Director, Programming/Computer Operations
> New Jersey Devils
> (973)757-6164
> [email protected]
>
[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://mail.leafe.com/mailman/listinfo/profox
OT-free version of this list: http://mail.leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/7d9e7f72b813014c8fd022cf04f820edd440d...@ex08.drdad.thenewarkarena.com
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to