Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Embedding a JPG in a general field

Status
Not open for further replies.

dmusicant

Programmer
Mar 29, 2005
252
0
0
US
I have a table with a general field and I copied a JPG to my clipboard simply by pressing Control + C while viewing the picture in the stock Microsoft Photos app in Windows 10. I went into the general field and pasted the image. I saw it, although what I saw was a section of the photo, far from the whole thing. I then went out of the general field, back in hoping to see the whole thing. Instead I got error messages. Can't access that record at all now, don't know how to get whatever's in there out of the general field. Going to a command window and doing REPLACE gen (the name of my general field) with "" results in a data mismatch error message.

So, my workaround for this was to copy other relevant into (there's one field that has all that, so that was easy), then delete the record and pack the table and recreate my record, sans that whatever in the general field.

Well, I've heard that there are better ways of getting a picture into a general field than what I did but don't remember any details about it. I think it involved providing the address of the image file (in this case, a JPG). What do I do? Open the general field and type something like this:

W:\data\pictures\mypicture.jpg


???

Thanks for help on this.
 
Append general is the only official way to write the gen field and the only official way out is a bound ole control.

Why would you want that? Don't use gen fields, they don't exist. Act as if they don't exist.

Either use blob and hen it comes to image you want to use for your UI, use an image control, let the picture property point to the file location and the image is shown at design time and runtime, the jpg is put into your pjx and when you build an exe the jpg becomes part of your exe. There is no need for binaries in data. In the extreme rarest cases.

There's APPEND MEMO, which is there for memo and blob and you can also populate them with text or data you put into binary format with CREATEBINARY() or simply read into a string var via FILETOSTR() or using APPEND MEMO FROM a filename. And for GEN you only have the APPEND GENERAL command.

Don't.

Bye, Olaf.




Olaf Doschke Software Engineering
 
A word of caution. Do Not store the JPG image itself in any data table field.

Instead store the JPG file itself in a Windows directory and store its fully pathed file name in the data table. That way your application can readily 'find' and use it.

It is a much safer approach.

Good Luck,
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top