Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Tore Bleken
  Where is Tore Bleken?
 Stokke
 Norway
 Tore Bleken
 To: bennet eze
  Where is bennet eze?
 LAGOS
 Nigeria
 bennet eze
 Tags
Subject: RE: pictures in reports
Thread ID: 395764 Message ID: 395932 # Views: 27 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: Reports and Printers
Date: Tuesday, January 21, 2014 3:21:07 PM         
   


> >
> > You can extract all the pictures this way:
> > 
> > Local lcId As String, ;
> >    lcImageFolder As String, ;
> >    lcImagefield As String, ;
> >    lcType As String
> > m.lcImagefield = [image] && Replace with correct field name
> > m.lcId = [pk] && Replace with unique field name, I assume that it's character type
> > m.lcImageFolder = [picture] && Replace with picture folder name
> > Scan
> >    m.lcType = filetype(Evaluate(m.lcId)
> >    If !Empty(m.lcType)
> >       Copy Memo (m.lcImagefield) To (Addbs(m.lcImageFolder) + Trim(Evaluate(m.lcId)) + [.] + m.lcType)
> >    Endif
> > Endscan
> > 
> > Function filetype
> >    Lparameters lcData
> >    Local laDummy[1], ;
> >       lcContents As String, ;
> >       lcReturn As String, ;
> >       lnHandle As Number
> >    If Pcount() = 0 Or Vartype(lcData) # [C]
> >       lcReturn = []
> >    Else
> >       If Len(Trim(lcData)) < 1000 And Adir(laDummy, lcData) > 0 && File
> >          lnHandle = Fopen(lcData)
> >          lcContents = Fread(lnHandle, 50)
> >          Fclose(lnHandle)
> >       Else && Memory variab√łe
> >          lcContents = lcData
> >       Endif
> >       Do Case
> >          Case Len(lcContents) < 4
> >             lcReturn = []
> >          Case Left(lcContents, 3) = Chr(0xFF) + Chr(0xD8) + Chr(0xFF)
> >             lcReturn = [JPG]
> >          Case Left(lcContents, 3) = [GIF]
> >             lcReturn = [GIF]
> >          Case Substr(lcContents, 42, 3) = [EMF]
> >             lcReturn = [EMF]
> >          Case Left(lcContents, 4) = Chr(0xd0) + Chr(0xcf) + Chr(0x11) + Chr(0xe0)
> >             lcReturn = [XLS]
> >          Case Left(lcContents, 4) = Chr(0xD7) + Chr(0xCD) + Chr(0xC6) + Chr(0x9A)
> >             lcReturn = [WMF]
> >          Case Left(lcContents, 4) = Chr(0x4D) + Chr(0x4D) + Chr(0x00) + Chr(0x2A)
> >             lcReturn = [TIF]
> >          Case Left(lcContents, 4) = Chr(0x89) + [PNG]
> >             lcReturn = [PNG]
> >          Case Left(lcContents, 5) = Chr(0xd0) + Chr(0xcf) + Chr(0x11) + Chr(0xe0) + Chr(0xA1)
> >             lcReturn = [DOC]
> >          Case Left(lcContents, 5) = [%PDF-]
> >             lcReturn = [PDF]
> >          Case Left(lcContents, 2) = [BM]
> >             lcReturn = [BMP]
> >          Case Left(lcContents, 3) = [CWS] And Asc(Substr(lcContents, 4, 1)) < 16
> >             lcReturn = [SWF]
> >          Case Left(lcContents, 3) = [FWS]  And Asc(Substr(lcContents, 4, 1)) < 16
> >             lcReturn = [SWF]
> >          Otherwise
> >             lcReturn = []
> >       Endcase
> >    Endif
> > Return lcReturn

> > There's a fine line between helping and adding to the confusion.
> >
> > How to create sample data
>
> Thanks for saving me valuable time. I have got back my pictures.
>
> Bennet Eze

You're welcome.

There's a fine line between helping and adding to the confusion.

How to create sample data

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