images and text with response

  • Thread starter Thread starter SergioT
  • Start date Start date
S

SergioT

Hi

I got a sql's table with images and i need to show the image on a popup with
some text, my problem is that the text did not show up only the image

'------------Show the image ( works fine)
Response.Buffer = True
Response.ContentType = oImg.Formato.Trim
Response.BinaryWrite(oImg.Imagen)

'-------show the image name ( does not work)

Response.ContentType = sContent
Response.Write("<strong>Cod.: </strong>" & sCodPer & "<br>")
Response.Write("<strong>Name : </strong>" & sNombreCompleto)

Where is my mistake???
Thanks in Advance
bye
 
You can't mix them like this. If you want to write an image to the output
stream then you can only have an image. You can't mix it with other content.
There is a way around this though. The way is to have a page that has an
image tag. This image tag points to another page whose only job is to write
the image to the output stream. For example, the url for the image may look
like generateimage.aspx?id=1. You can pass id parameters to it whoever you
need in order to tell the page to which image to generate. Then the image is
generated into the output stream and seen by the browser as an image file,
thus tying the image element to a valid image from the server. you can put
anything else you want on that page in addition to the image tag, such as a
literal or label to contain the content or descriptive information about the
image.
 
Hi Mark

Thanks for your tip!!! I gonna try

If I understood :

I have to put something like this: <IMG alt=""
src="myImagePage.aspx?show=1"> on my page and all the process to show the
image I mus do it on "myImagePage.aspx" Is that correct?

bye and thanks again
 
That's exactly correct. you just need the image tag to call have the script
to generate the image as it's source. Unfortunately, in the case of wanting
to have an image and a description dynamically generated, it results with
two database calls (one from the image page to get the image and the other
to get the description that goes with the image).
 
Hi Mark

THANKS!!! it works really nice

Bye


Mark Fitzpatrick said:
That's exactly correct. you just need the image tag to call have the
script to generate the image as it's source. Unfortunately, in the case of
wanting to have an image and a description dynamically generated, it
results with two database calls (one from the image page to get the image
and the other to get the description that goes with the image).

--

Hope this helps,
Mark Fitzpatrick
Former Microsoft FrontPage MVP 199?-2006
 
Back
Top