how can i store image into database and view it in grid view?
View Complete Post
I am trying to resize images after uploading and than inserting them into my database.
Dim newMainImage As System.IO.Stream = System.IO.Stream.NullresizedMainImage.Save(newMainImage, jgpEncoder, myEncoderParameters)Dim newMain As Image = Image.FromStream(newMainImage)
I was able to resize it however I couldnt find a way to convert image object to byte() in order to
I need something like
Dim ImageContent(newMain.ContentLength - 1) As BytenewMain.InputStream.Read(ImageContent, 0 , newMain.ContentLength)
I need to convert image object to a file type in order to get its contentlenght and use .inputStream.Read function. Or is there any other way?
My database has a products table that has images stored in a varbinary(MAX) column.
I'm trying to display product information in a repeater and trying to display the images as well by using a GenericHandler class but I can't get the image to show up in my page.
Here is my Handler.ashx class:
Public Class Handler
Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest
'== Set up the response settings
context.Response.ContentType = "image/gif"
context.Response.BufferOutput = False
Dim id As Integer = -1
Dim stream As Stream = Nothing
If Not String.IsNullOrEmpty(context.Request.QueryString("id")) Then
id = context.Request.QueryString("id")
stream = GetImage(id)
Const buffersize As Integer = 1024 * 16
Dim buffer(buffersize) As Byte
'byte buffer = new byte[buffersize];
Dim count As Integer = stream.Read(buffer, 0, buffersize)
While count > 0
context.Response.OutputStream.Write(buffer, 0, count)
count = stream.Read(buffer, 0, buffersize)
I have followed the example from this page for vb.net.
The upload works fine, but not the download. Everything is as the example but its not working. This in running in my development enviroment i.e httpL/localhost.
Do i have to configure my asp.net or something, or the image control on my web page.
Can anybody help.
i wanat to display Client Name, Field and image in datalist. Stored Procedure like this
I'm having a heck of a time getting an image to display from a SQL database. When I view the source of the page in Firefox and then click on the link in the source for the image control, I see the following message:
The image "view-source:http://localhost:4484/mySite/Handler.ashx?m=1342" cannot be displayed, because it contains errors.
Here are the details:
The column holding the image is an "image" data type.
Code on the ~/some_members/members.aspx page:
<asp:Image ID="Image1" runat="server" />
Code behind for the members.aspx page:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Image1.ImageUrl = "~/Handler.ashx?m=" & Request.QueryString("m")
<%@ WebHandler Language="VB" Class="Handler" %>Imports SystemImports System.WebPublic Class Handler : Implements IHttpHandler Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest Dim rdr As System.Data.SqlClient.SqlDataReader = Nothing Dim conn As System.Data.SqlClient.SqlConnection = Nothing
Ok I need some help. I'm on my test DB and I have a table that has an image inside of it. How can I script an image so when I move from my test DB to my productino DB i can just run the script and have my images inserted in the table.
My table is called Faculty_PhotoInfo with these columns:
Right now if I insert a row into the table it will show up like this:
3 <Binary data>
IMG_TESTIMAGE.jpg Mr.Johnson Head Teacher Test Description
The part I don't understand how to do is, these images will stay on my local test machine. So when I run the script on the Production site how will it know what these images are?
Thanks you all!!