Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sending images to Browser with VB 4.0

Posted on 1998-11-04
7
Medium Priority
?
178 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
How to Create Failover DNS Record Sets in Route 53

Route 53 has the ability to easily configure DNS record sets specifically for failover scenarios. These failover record sets can be configured to failover to full-blown deployments in other regions or to a static HTML page that informs your customers of the issue.

 

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

Application Discovery Service in AWS

In the era of the cloud, customers migrating away from their existing on-premise infrastructure. This requires lots of planning, strategies, and effort to identify their existing resources and determine how best to migrate.  Datacenter migrations happen in four phases -

Question has a verified solution.

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

In this tutorial I will show you how to provide a dynamic RTF document on your website generated with data from your database. For this tutorial you will need Microsoft Word or WordPad, WhizBase and Microsoft Access. In this tutorial I will show …
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…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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…

722 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