All Things WinBatch > WebBatch

Displaying local image in web file

(1/3) > >>

Jeff:
Hi all!

When I am displaying a jpg or png file in my browser using the url path to the image it is fine. I can open and view a local image file through my browser just fine.

When I attempt to display a local image file veiwing a .web file, I get the typical image encoding. Not the rendered picture.

Is there a way to render the picture? Any suggestions is helpful.


--- Code: ---WebOut( 'Content-type: text/html', 2) ; Output HTML Context type
WebOut( '<html> <head> <title>Display File Attachment Download</title> </head> <body>', 1)
WebOut("Server side image displays fine!<br>",1)
WebOut('<img alt="/webcgi/kb/pix/MyImage.jpg" height="80" SRC="/webcgi/kb/pix/MyImage.jpg" width="80" />',1)
WebOut("<br>",1)
USERNAME = ItemExtract(2,Environment("REMOTE_USER"),"\")
DefaultDownloadFolder=StrCat("C:\Users\",USERNAME,"\Documents")
WebOut("Client side image not pretty!<br><br>",1)
WebOut(StrCat(DefaultDownloadFolder,"\MyImage.jpg<br>"),1)
WebOutFile(StrCat(DefaultDownloadFolder,"\MrImage.jpg"))
WebOut('</body>',1)
WebOut('</html>',1)
--- End code ---

td:
Please review the Stones.web file in the Stones folder of your WebBatch installation.  The script contains an example of how to display an image in HTML output.

Jeff:
Thanks for the quick response. I may not be explaining myself very well.

After saving a jpg or png or even a pdf to my local computer I am then trying to open in the same browser session. When I try your suggestion....

1. The GIF file must be in the current directory. If I am working within the current directory structure, I can simply: WebOut('<img alt="" height="80" SRC="/webcgi/kb/pix/MyImage.jpg"" width="80" />',1.
 
2. Dumpgif displays the specified .GIF file in a browser. When I try a jpg, I get the error "WebBatch Error: File does not have an extension of '.GIF'".

td:
Do you understand the purpose of WebBatch?  It is a CGI scripting tool and must be executed from a Web server.  To view an image using WebBatch you would need to use a browser to connect to the Website running WebBatch using a URL.  The communication process is handled via the HTTP protocol.  Any client-side file system access is handled by the client software not WebBatch server software.

Jeff:
Thanks for your help.

Navigation

[0] Message Index

[#] Next page

Go to full version