KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Dynamically display a picture on a web page
PRODUCT: 4D | VERSION: 6.8.4 | PLATFORM: Mac & Win
Published On: September 2, 2003

Versions 6.8.x and 2003.x

Here is an example on how to dynamically display a picture on a web page.

1. Create a method that puts a picture into a blob and send the blob to the web browser.

` Method: ShowPicture
C_TEXT($1)
C_BLOB($xGif)
C_PICTURE($Picture)

GET PICTURE FROM LIBRARY(861;$Picture)
PICTURE TO GIF($Picture;$xGif)

SEND HTML BLOB($xGif;"image/gif")

Note: In this example, the picture is extracted from the Picture Library.

2. Insert an img tag that calls the above method in the HTML file.

<html>
<body>
<img src="/4DACTION/ShowPicture">
</body>
</html>

Once the HTML file is sent from 4D using the command SEND HTML FILE, the picture will appear on the web page.

  ` Method: SendHTML
SEND HTML FILE("File.html")

Note: despite the use of PICTURE TO GIF, QuickTime does not need to be installed on the machine.