Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Paul Gibson
  Where is Paul Gibson?
 Glasgow
 United Kingdom
 Paul Gibson
 To: bennet eze
  Where is bennet eze?
 LAGOS
 Nigeria
 bennet eze
 Tags
Subject: RE: pictures in reports
Thread ID: 395764 Message ID: 395871 # Views: 39 # Ratings: 2
Version: Visual FoxPro 9 SP2 Category: Reports and Printers
Date: Monday, January 20, 2014 10:16:57 PM         
   


> >
> > Like others I would not recommend storing images into any field in a DBF file but later on in this reply I will show how we reference different images on reports. Depending on what the table is for and how many images you realistically might have the table could get to ridiculous unwieldy sizes very quickly. In another job we used to have an application that stored letters (RTF files) into a table, the table was not expected to have hundreds of thousands of letters in it so that was OK but then users decided that they wanted to have letters with graphics on them, in particular they wanted reasonably high resolution signatures on the documents and some wanted logos as well. This resulted in the RTF sizes growing dramatically and soon some of the users found themselves hitting the 2GB file size limit. Anyway that's just a simple example that even with the best intentions user's behaviour can shoot a concept out of the water and make a reasonable design decision appear to be wrong.
> >
> > However, whether you store the images in a table or not you should be able to cater for it on any report. In our Auction application we store images of items in file/folder structures, the users can store 1 or many images for each item so we do not want to store the images in a table. On our picture catalogue report we've got an image control where the control source type is set to "Expression or variable name" and in the control source we've got a function call. The function call goes to a UDF which looks for the image within the file/folder structure and returns the full path to the file. It could also go to a UDF which extracts the image out of a memo field to a physical file (a random file name in the user's temp folder perhaps) and returns the full path to the file.
> >
> > One important thing to note is that the UDF has to return a valid path to a valid file in all circumstances or the report will throw an error. In my UDF if the image is broken I return a path to an image that says "Image Broken" on it, if the image cannot be found the UDF returns a path to a tiny, empty image.
>
> I agree with all of you that it is better to store the images outside the database but in my case, some of the image files are no longer available and I have to rely on the ones stored in the memo fields. Before I can get the image files back, I may have to use your method of extracting the images from the memo fields. Which command or fuction can i use to extract an image from a memo field.
>

Well that depends how they were put there in the first place. It may be that the information has been put into the memo fields with a simple FILETOSTR() function, if so then the reverse function call STRTOFILE() will allow you to recreate the files. You specifically note that they are memo (binary) fields and I must admit that I do not have a huge amount of experience of dealing with memo (binary) fields simply because I've avoided using them for the purpose you are.

Try STRTOFILE(), hope that works for you.

EDIT: Or Tore's solution would also work. I get exactly the same result with StrToFile and COPY MEMO

ENTIRE THREAD

pictures in reports Posted by bennet eze @ 1/18/2014 4:45:09 PM
RE: pictures in reports Posted by Pete Sass @ 1/18/2014 6:02:41 PM
RE: pictures in reports Posted by bennet eze @ 1/18/2014 9:40:29 PM
RE: pictures in reports Posted by Pete Sass @ 1/18/2014 11:21:57 PM
RE: pictures in reports Posted by Jun Tangunan @ 1/19/2014 1:31:28 AM
RE: pictures in reports Posted by David Mustakim @ 1/19/2014 4:11:23 AM
RE: pictures in reports Posted by Paul Gibson @ 1/20/2014 10:50:11 AM
RE: pictures in reports Posted by bennet eze @ 1/20/2014 9:10:18 PM
RE: pictures in reports Posted by Tore Bleken @ 1/20/2014 9:52:36 PM
RE: pictures in reports Posted by Paul Gibson @ 1/20/2014 10:16:57 PM
RE: pictures in reports Posted by David Mustakim @ 1/20/2014 10:21:27 PM
RE: pictures in reports Posted by Paul Gibson @ 1/20/2014 10:27:16 PM
RE: pictures in reports Posted by David Mustakim @ 1/20/2014 10:36:56 PM
RE: pictures in reports Posted by Paul Gibson @ 1/20/2014 10:46:06 PM
RE: pictures in reports Posted by bennet eze @ 1/21/2014 12:58:56 AM
RE: pictures in reports Posted by Vilhelm-Ion Praisach @ 1/21/2014 6:21:14 AM
RE: pictures in reports Posted by David Mustakim @ 1/21/2014 8:25:06 AM
RE: pictures in reports Posted by Paul Gibson @ 1/20/2014 10:43:46 PM
RE: pictures in reports Posted by bennet eze @ 1/21/2014 7:56:17 AM
RE: pictures in reports Posted by Tore Bleken @ 1/21/2014 9:59:45 AM
RE: pictures in reports Posted by bennet eze @ 1/21/2014 3:11:14 PM
RE: pictures in reports Posted by Tore Bleken @ 1/21/2014 3:21:07 PM
RE: pictures in reports Posted by Vilhelm-Ion Praisach @ 1/20/2014 10:24:51 PM
RE: pictures in reports Posted by tom knauf @ 1/21/2014 5:04:36 PM