Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: FoxGuy Ruiz
  Where is FoxGuy Ruiz?
 hawthorne
 California - United States
 FoxGuy Ruiz
 To: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 Tags
Subject: RE: Storing the path of an image in table
Thread ID: 143448 Message ID: 143554 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: General VFP Topics
Date: Wednesday, August 29, 2007 8:07:30 PM         
   


in the code that you supplied to me mytable should be replace with the name of my table right? For the code
lcImageFileName = [Img]+ALLTRIM(TRANSFORM(MyTable.RecordID))+[.jpg]
ThisForm.MyImage.Picture = ADDBS(lcImagePath)+lcImageFileName

do i wite it exactly like you gave it to me, with the brakects and the parentheses?


> > I did read your suggestion, but i'm a little bit slow on programming. (well I'm learning). In our company we already have an invertory list of different fresh water fish, what i wanted to do is to add a field in that table that we called inv.dbf that stores the path of an image of every fish, but i don't know how to store the path to an image in a table this table. After storing the path i would like to open it with a form, showing the image. For example let say that where i keep the images of all the fishes is on c:\fish\images and then the different names of the bmps, how can i store this path the table and later retrieve this image in a form.
> >
> > I'm sorry to bug a lot, you might be thinking " this kid should go to school"
> >
> > Thanks
> >
>
> Foxguy,
>
> We were all "kids" at one time. When I was first starting out a few generous people answered some of my questions. I would repay them poorly were I not to answer some of your questions.
>
> The easiest way to handle this would be to re-name the image files. Lets assume that your image of a codfish is called "codfish.jpg" and the record ID for your codfish record is 12345. You could do this:
>
> * Note - you probably would not want to rename these images in VFP but instead, do it in Windows Explorer
> * I offer the VFP version just to show you what I mean by "renaming the file."
> RENAME [c:\Fish\Images\CodFish.Jpg] TO [c:\Fish\Images\Img12345.Jpg]
> 
> * and then in your form when you wish to display that image
> lcImagePath = [c:\Fish\Images] && or what ever (best not to hard code paths but this serves as an example)
> lcImageFileName = [Img]+ALLTRIM(TRANSFORM(MyTable.RecordID))+[.jpg]
> ThisForm.MyImage.Picture = ADDBS(lcImagePath)+lcImageFileName
> 

>
> Depending on how many images you have, renaming all of those images may be a bit of a chore, but you only have to do it once. On the other hand, by doing it this way you need store nothing in the tables. You already store the record ID (you need a record ID field for your primary key field.) Your image files are certainly not going to impact on that 2 Gig maximum file size limit.
>
> It may be that you have other issues that make this solution impossible. In that case, add a memo field to your table called "cImage." You can then
>
> LOCATE FOR MyTable.FishName = [CodFish]
> lcImage = FULLPATH(GETPICT()) && Here the user will navigate to that Codfish.jpg file.
> IF NOT EMPTY(lcImage)
>    REPLACE MyTable.cImage WITH lcImage IN [MyTable]
> ENDIF
> 
> * And in your form,
> ThisForm.MyImage.Picture = MyTable.cImage
> 

>
> Give it a bit of a play and see what you come up with. If you run into problems, come back with a question.
>
> Ken
> You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

Storing the path of an image in table Posted by FoxGuy Degante @ 8/28/2007 10:43:38 PM
RE: Storing the path of an image in table Posted by Ken Murphy @ 8/28/2007 10:57:43 PM
RE: Storing the path of an image in table Posted by FoxGuy Degante @ 8/28/2007 11:22:08 PM
RE: Storing the path of an image in table Posted by Ken Murphy @ 8/28/2007 11:32:16 PM
RE: Storing the path of an image in table Posted by FoxGuy Degante @ 8/29/2007 4:15:52 AM
RE: Storing the path of an image in table Posted by Ken Murphy @ 8/29/2007 4:50:59 AM
RE: Storing the path of an image in table Posted by FoxGuy Degante @ 8/29/2007 8:07:30 PM
RE: Storing the path of an image in table Posted by Ken Murphy @ 8/29/2007 8:41:41 PM