[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.aspnet.webcontrols

Displaying an image file that is not in the web directory

Javier

2/26/2004 10:06:00 PM

Hi all

does anyone know of a way to display an image that is not in the web directory, as a part of a page

Javier
1 Answer

vMike

2/27/2004 6:40:00 PM

0

You can set the img src tag to an aspx file ... say
getpic.aspx?_p=yourpicname ... and use something like this snip (not
tested).

Sub Page_Load(sender as object, e as eventArgs)
Response.ContentType = "image/jpeg"
dim strPics as string = Request.QueryString.Item("_p")
mgGenerateImage(strPics)
End Sub


Sub mgGenerateImage(strPics as string)
dim strNavPath as string = "c:\yournonwebpath\" 'probably want to store
setting in webconfig
dim myNewImage as system.drawing.image
try
myNewImage = New Bitmap(strNavPath & "strPics" & ".jpg")
mynewimage.Save(Response.OutputStream, ImageFormat.Jpeg)

catch
myNewImage = New Bitmap(strNavPath & "yourdefaultimage.jpg")
mynewimage.Save(Response.OutputStream, ImageFormat.Jpeg)

end try
mynewimage.dispose()
End Sub

You will need System.Drawing and System.Drawing.Imaging namespaces

"Javier" <hgalindo@engineer.com> wrote in message
news:CB51B496-A2A0-4552-AD79-FCBDE869C945@microsoft.com...
> Hi all,
>
> does anyone know of a way to display an image that is not in the web
directory, as a part of a page?
>
> Javier