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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

picture in memo

Status
Not open for further replies.

misulica

Programmer
Feb 8, 2003
43
RO
From an example I use:
Append Memo Picture From G:\Album\canada1.jpg Overwrite

to put a picture into a binary memo field.I have 10 records in the table, the column memo name is Picture.In those 10 records appear MEMO into the cells below title PICTURE.
When I put this command line (to see if it work) in the Command Editor I receive this message:
Command contains unrecognized phrase/keyword

Is this because Append Memo Picture, but the memo cell's name is Memo?
What to do?Thanks
 
It's NEVER a good idea to use a VFP reserved as a field name. Sometimes the parser simply can't resolve the ambiguity.
Try:
Append Memo mytable.Picture From G:\Album\canada1.jpg Overwrite

Rick
 
rgbean, unfortunatelly didn't work.The column looks like:
Picture
memo
memo
memo
...n times
I couldn't call Picture, because the photo is in the memo cell
 
Now you've got me confused. In the first message you said "... the column memo name is Picture.". What exactly is the structure of your table? Memo is a type of field, and in a Browse, "memo" indicates nothing was stored in it, and "Memo" indicates there is something in the memo.

I really don't know what to make of your last information - maybe I'm just having a bad day understanding.

Rick
 
I have a table with 8 columns:
ID ProductName Weight Dimensions Price Picture Producer Tel
1 Something 0,8 120x350 100$ memo John Doe 12

As you can see, I have records in every field of the table, except the memo field Picture who has at record no.1 only the word memo,in this cell is nothing.
Now, I have 10 records, in the cells below Picture appeared only memo,memo,... without having something inside those cells (I named it cell to make the difference between title Picture of the memo field and memo word of the memo field)
Now you understand what I want to say?
Under picture appeared memo give by VFP, not by me, and I can't rename those memo into photo1,photo2,...photo9999 as I think it should be.
So, what to do?
 
Hi Misulica,

OK, so what you're saying is that the field name is Picture, but when you look at the Browse screen, you see the word "memo" repeated in every cell.

In that case, "memo" is not a field name, it is just an indication that the field is a memo field. Think of it as a place-holder. When you double-click on "memo" in the Browse, it will open an editor window where you will see the memo text.

With that in mind, your syntax is correct, except that, as Rick says, you shouldn't name your field Picture because that's a keyword in VFP.

But I am not clear what you are trying to achieve. It looks like you are trying to store the contents of a JPG file in a memo field. Why do you want to do that?

Perhaps if you tell us what your overall aim is, we might be able to suggest a better solution.

Mike
Mike Lewis
Edinburgh, Scotland
 
Picture is indeed a keyword, but I only translate (Photo is a better translation) from romanian - so, no problem,the whole database haven't any keyword.Second answer:what I'm trying to achieve - read the text below and you will see why(this was an idea of mgagnon I guess, he give me the address of a site with the answer to my question - I need a photo of any product from my database).Here is the answer of that site:

Many developers choose General fields because they don't want to have the files separate from the table. The user shouldn't be able to break the application by accidentally deleting the image files.
In this situation, use a binary memo field instead of a General field. You can use this line to get the file into the memo field:

Append Memo Img From <File> Overwrite

where Img is the name of the binary memo field. In Visual FoxPro 6.0, use an image control to display such a .JPEG file. This requires the following code in the Refresh event of the form:

Local lcFile
* Delete the previous image, if it exists
If File(This.Image.Picture)
Erase (This.Image.Picture)
Endif
* Create a new temporary file on disk
* SYS(2023) returns the current temporary path
lcFile = SYS(2023)+&quot;\&quot;+Sys(3)+&quot;.JPG&quot;
Copy Memo myTable.Img to (m.lcFile)
This.Image.Picture = m.lcFile
 
Hi Misulica,

OK, I understand now what you are trying to achieve.

I really think that you should use a character field rather than a memo (or binary memo or general) field. Use the character field to store the path and name of the JPG file.

In your form, set the Picture property of the image control to the path and name stored in the character field. Do that every time you move the record pointer.

I think you will find this much easier and more efficient.

It is true that the user might accidently delete the JPG, but there is always a risk of a user accidently deleting an important file, like a DBF. In any case, if a JPG is deleted, it won't break the application. You can test for the presence of the file, and if it is missing, just set the Picture property to an empty string.

Hope this helps.

Mike
Mike Lewis
Edinburgh, Scotland
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top