To directly put the filename in, the file would need to be in the web-tree, which is why you need to use the spew. The function that sends the image should be fairly simple, e.g.
now I am trying to use BLOB field type for a bunch of small .gif files
import schema
...
field i_filename varchar(10) 1
field I_image blob 2
...
sql insert stmt:
...
$i_filename,
fromfile($i_filename)
...
my question is, How do I retrieve and display the gif image in the blob field?
Can't use send, can't use spew, just plain $i_image does not seem to work, below
is an attempt to pass the filename and showsrc does a query and displays (using $i_image),
This does not work
The push demo above uses <spew> with an indirect for the large image, and <fmt %s> with a varbyte for the thumbnail. You should convert the blob to a varbyte in the select, and use <fmt %s> to display it, e.g.
<a name=fshowsrc public>
<sql MAX=1 "select convert(l_image, 'varbyte') Img from Table where ...">
<fmt %s $Img>
</sql>
</a>
Obviously it is important that you don't generate any other output in the function that would cause the data to no longer be a valid image.
That looks mostly correct, although it should know gif automatically. The two things that I would suggest would be to URL encode the filename, not sure if there are any strange characters: