arapahoe
asked on
Sending images to Browser with VB 4.0
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'??.
If i would send a image (gif) i need to use de procedure 'SendB'??. What mean 'Content-type image/jpeg'??.
ASKER
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???
--------------------------
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???
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
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
ASKER
OK!!.
I think this solution its ok.
Thanks
I think this solution its ok.
Thanks
Glad to hear it, can I post it again as an answer?
Michel
Michel
ASKER
Yes, and thanks again
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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