Server-side object | |
Implemented in | LiveWire 1.0 |
blob
object. Instead, if you know that the value of a cursor
property contains BLOb data, you use these methods to access that data:
| Displays BLOb data stored in a database. |
| Displays a link that references BLOb data with a link. |
Conversely, to store BLOb data in a database, use the blob
function.
Method of |
blob
|
Implemented in | LiveWire 1.0 |
cursorName.colName.blobImage (format, altText, align, widthPixels, heightPixels, borderPixels, ismap)
blobImage
to create an HTML image tag for a graphic image in a standard format such as GIF or JPEG.
The blobImage
method fetches a BLOb from the database, creates a temporary file (in memory) of the specified format, and generates an HTML image tag that refers to the temporary file. The JavaScript runtime engine removes the temporary file after the page is generated and sent to the client.
cursor = connobj.cursor("SELECT NAME, THUMB FROM FISHTBL WHERE ID=2")These statements produce this HTML:
write(cursor.name + " ")
write(cursor.thumb.blobImage("gif"))
write("<BR>")
cursor.close()
Anthia <IMG SRC="LIVEWIRE_TEMP11"><BR>Example 2. The following example creates a cursor from the
rockStarBios
table and uses blobImage
to display an image retrieved from the photos
column:cursor = database.cursor("SELECT * FROM rockStarBiosThis example displays an image as if it were created by the following HTML:
WHERE starID = 23")
while(cursor.next()) {
write(cursor.photos.blobImage("gif", "Picture", "left",
30, 30, 0,false))
}
cursor.close()
<IMG SRC="livewire_temp.gif" ALT="Picture" ALIGN=LEFTThe
WIDTH=30 HEIGHT=30 BORDER=0>
livewire_temp.gif
file in this example is the file in which the rockStarBios
table stores the BLOb data.
Method of |
blob
|
Implemented in | LiveWire 1.0 |
cursorName.colName.blobLink (mimeType, linkText)
blobLink
if you do not want to display graphics (to reduce bandwidth requirements) or if you want to provide a link to an audio clip or other multimedia content not viewable inline.
The blobLink
method fetches BLOb data from the database, creates a temporary file in memory, and generates a hypertext link to the temporary file. The JavaScript runtime engine on the server removes the temporary files that blobLink
creates after the user clicks the link or sixty seconds after the request has been processed.
cursor = connobj.cursor("SELECT NAME, PICTURE FROM FISHTBL WHERE ID=2")These statements produce this HTML:
write(cursor.name + " ")
write(cursor.picture.blobLink("image/gif", "Link" + cursor.id))
write("<BR>")
cursor.close()
Anthia <A HREF="LIVEWIRE_TEMP2">Link2</A><BR>Example 2. The following example creates a cursor from the
rockStarBios
table and uses blobLink
to create links to images retrieved from the photos
column:write("Click a link to display an image:<P>")This example generates the following HTML:
cursor = database.cursor("select * from rockStarBios")
while(cursor.next()) {
write(cursor.photos.blobLink("image/gif", "Image " + cursor.id))
write("<BR>")
}
cursor.close()
Click a link to display an image:<P>The
<A HREF="LIVEWIRE_TEMP1">Image 1</A><BR>
<A HREF="LIVEWIRE_TEMP2">Image 2</A><BR>
<A HREF="LIVEWIRE_TEMP3">Image 3</A><BR>
<A HREF="LIVEWIRE_TEMP4">Image 4</A><BR>
LIVEWIRE_TEMP
files in this example are temporary files created in memory by the blobLink
method.
Last Updated: 10/31/97 16:36:13