Solved

Sending images to Browser with VB 4.0

Posted on 1998-11-04
7
167 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

If you get a (Blue Screen of Death), your system writes a small file called a minidump. Your first step is to make certain your computer is setup to record memory dumps. Right click My Computer, choose properties. Click on the advanced tab, an…
In this tutorial I will show you how to make a simple HTML bar chart with the usage of WhizBase, If you want more information about WhizBase please read my previous articles at http://www.experts-exchange.com/ARTH_5123186.html (http://www.experts-ex…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

762 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

24 Experts available now in Live!

Get 1:1 Help Now