You have two actions:

list_image() -> returns an image (always image 1?)
ist_images() -> returns the html page.

In the latter you can do:

View:
  {{extend 'layout.html'}}
  <h3>Display Jpeg Images</h3>
  <table border="1">
    <tr>
       <th>Image Title</th>
       <th>Image Blob</th>
    </tr>
    {{for img in images:}}
        <tr>
            <td>{{ =img.title }}</td>
            <td>{{=img.image_blob }}/</td>
            <td><img src="{{=URL('list_image',args=img.id)}}" /></td>
<!-- added this line -->
        </tr>
    {{pass}}
  </table>

Anyway, I have the impression you are reinventing the wheel a little.
Did you look into "upload" field and the "download"action? They are
designed to do what you need.

On Feb 23, 11:28 pm, BrendanC <bren...@gmail.com> wrote:
> OK - Quick follow up here - I was able to display an blob image using the
> call:
>
> def list_image():
>
>    myid = 1    # test
>     image=db(db.xim.id==myid).select(orderby=db.xim.title)
>     response.headers['Content-Type']='image/jpeg'
>
>     mystream = image.image_blob
>     return mystream
>
> However this renders an image in separate page with no additional info.
> What I really want is to display the stream as part of a template (within
>  a table) with additional related image info (Title, Comments etc). IOW I
> want to embed the stream within an html template, rather than as a
> separate, standalone file.
>
> Am I missing piece of the puzzle here?

Reply via email to