Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Sending images to Browser with VB 4.0

Posted on 1998-11-04
7
Medium Priority
?
180 Views
Last Modified: 2013-12-25
I made a cgi with the module 'cgivb4.bas' from Kevin O'Brien and i send the date (text) with the procedure 'Send'.

If i would send a image (gif) i need to use de procedure 'SendB'??. What mean 'Content-type image/jpeg'??.
0
Comment
Question by:arapahoe
  • 4
  • 3
7 Comments
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1829408
The content-type is a so-called http header and it is used so the browser can identify the data being sent.
To send image data you need to use the binary version of send as I expect SendB is.

'Content-type image/jpeg' means that the data you sned is a jpg file but you would want
'Content-type image/gif'
instead.

make sure that there is an empty line after
'Content-type image/gif'

and here the image data should be sent.

Michel
0
 

Author Comment

by:arapahoe
ID: 1829409
I try with this code and not work:

------------------------------------------------------------
    While Not BDD_Result.EOF
        Send ("<tr>")
        Send ("    <td width=20%>")
        Send "Content-type: image/gif" & vbCrLf
        fdIN = FreeFile
        Open PathImatges & BDD_Result!numero_cliente & ".gif"
              For Binary As fdIN
        ContingutImatge = InputB(LOF(fdIN), fdIN)
        Close fdIN
        SendB (ContingutImatge)
        Send "Content-type: text/html" & vbCrLf
        Send ("    </td>")
        Send ("</tr>")
        BDD_Result.MoveNext
    Wend
    Send ("</table>")
-----------------------------------------------------


It's correct???
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1829410
Not at all!

HTML is text and can contain an image link. That image link points to an image file or in your case should point at an image producing cgi, passing the image name to the cgi:

  While Not BDD_Result.EOF
               Send ("<tr>")
               Send ("    <td width=20%>")
               Send ("    <IMG SRC=""othervbprogram?" & BDD_Result!numero_cliente & ".gif" & """)
               Send ("    </td>")
               Send ("</tr>")
               BDD_Result.MoveNext
           Wend
           Send ("</table>")

Please fix the quotes yourself, I am not a VB programmer.

Then have an othervbprogram that does an
    Send "Content-type: image/gif" & vbCrLf
               fdIN = FreeFile
               Open PathImatges & parameter
                     For Binary As fdIN
               ContingutImatge = InputB(LOF(fdIN), fdIN)
               Close fdIN
               SendB (ContingutImatge)

where parameter is what was after the ? in the image link...

Hope this helps

Michel
0
Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

 

Author Comment

by:arapahoe
ID: 1829411
OK!!.

I think this solution its ok.

Thanks
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1829412
Glad to hear it, can I post it again as an answer?

Michel


0
 

Author Comment

by:arapahoe
ID: 1829413
Yes, and thanks again
0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 400 total points
ID: 1829414
Thank,

 While Not BDD_Result.EOF
                      Send ("<tr>")
                      Send ("    <td width=20%>")
                      Send ("    <IMG SRC=""othervbprogram?" & BDD_Result!numero_cliente & ".gif" & """)
                      Send ("    </td>")
                      Send ("</tr>")
                      BDD_Result.MoveNext
                  Wend
                  Send ("</table>")

       Please fix the quotes yourself, I am not a VB programmer.

       Then have an othervbprogram that does an
           Send "Content-type: image/gif" & vbCrLf
                      fdIN = FreeFile
                      Open PathImatges & parameter
                            For Binary As fdIN
                      ContingutImatge = InputB(LOF(fdIN), fdIN)
                      Close fdIN
                      SendB (ContingutImatge)

       where parameter is what was after the ? in the image link...

Michel
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently I have been answering a lot of questions like this in IT forums that I frequent. The question posed is usually something along the lines of "We have software X installed and need to uninstall it for reason Y" or some other variant of the sa…
I hope you'll find this tutorial useful and interesting. So let's try to extend Tcl with a new package.  For anyone more deeply interested please check out the book "Practical Programming in Tcl and Tk". It's really one of the best written books abo…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

972 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question