Solved

Sending images to Browser with VB 4.0

Posted on 1998-11-04
7
168 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 

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 100 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

Introduction This tutorial will give you a fast look what you can do with WhizBase. I expect you already know how to work with HTML at least, and that you understand the basics of the internet and how the internet works. WhizBase is a server-s…
It is becoming increasingly popular to have a front-page slider on a web site. Nearly every TV website,  magazine or online news has one on their site, and even some e-commerce sites have one. Today you can use sliders with Joomla, WordPress or …
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

895 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now