I have a sculptor's website to complete, but I'm stuck on the Gallery portion of the site. Due to security and other concerns, the images are stored in a database as BLOB data. Please don't waste your answer on telling me to change it to directory-based storage, okay? I'm just following orders here. Anyway, I have a simple getImage page that will retrieve single images from the SQL db with no problem. (I found the code on the Net somewhere.) The page has no UI, just code I call from an 'OpenArt' page, using the following code to set the image URL for an <asp:image> tag: imgArt.imageURL = "../getImg.aspx?id=1"
In the gallery there is a list of art pieces, each being an <asp:hyperlink>. When the user clicks a link, I grab the imgID from a session variable, enabling the user to see the piece's image, the price, et cetera.
Well, the artist now wants thumbnail images instead of hyperlinks. That blows my system out of the water.
NOTE: storing thumbnails in the database is not an option. The artist must be able to maintain the site herself, and she lacks the skills to make her own thumbnail images. Thumbnails must be made on the fly in this case.
I can't get the getImg.aspx page to respond to anything I pass in the queryString, and I don't understand the '?id=1' part of the URL (getImg.aspx?id=1) I use to call the page. Where does this 'id' come from? Right now I'm using a session variable to provide the imgID for the db retrieval sproc (note the indented line below). This obviously won't work for multiple images on a single Gallery page. I've tried no less than 20 links around the Net to try to figure this out, and I'm just tired of it. Thanks for any help I can get.
Here's the code for getImg.aspx:
dim objConn as sqlConnection
dim objCmdGetImg as sqlCommand
dim strConn as string = ConfigurationSettings.AppSettings("dbConnStr")
dim rdrGetImg as sqlDataReader
objConn = new sqlConnection(strConn)
objCmdGetImg = new sqlCommand("db_getImg", objConn)
objCmdGetImg.commandType = commandType.storedProcedure
objCmdGetImg.Parameters.Add("@imgID", sqlDBType.bigint).value = Session("imgID")
rdrGetImg = objCmdGetImg.executeReader(CommandBehavior.CloseConnection)
if rdrGetImg.hasRows then
Do While rdrGetImg.Read
Response.ContentType = rdrGetImg.Item(0)
Catch SQLexc As SqlException
Response.Write("Read Failed : " & SQLexc.ToString())