Last post May 31, 2007 01:52 PM by blink18jew
May 28, 2007 09:57 AM|blink18jew|LINK
I have a code to upload the name of the image and the caption as well as all relevent infomation such as the album number and such. It then uploads the image to the correct folder. I wish to also upload the images width / height. I can not find any way
of simply doing this. Does anyone know how to do this?
FileUpload1.SaveAs(Server.MapPath(@"~\PictureThis\LandLords\") + CurrentID + "\"" + QueryStringID + "\"" + PhotoNumber.Text + ".gif");
string NewPicature = ConfigurationManager.ConnectionStrings["BlinkConnectionString"].ToString();
SqlConnection NewPicatureCon = new SqlConnection(NewPicature);
SqlCommand Command8 = new SqlCommand("INSERT INTO LandlordPhotos(PropertyID, LandlordID, PhotoURL, Caption, Main, DateAdded) VALUES (@PROPID, @LANDID, @IMAGEURL, @CAPTION, @MAIN, @DATE)");
Command8.Parameters.Add("@PROPID", SqlDbType.Int).Value = QueryStringID;
Command8.Parameters.Add("@LANDID", SqlDbType.Int).Value = CurrentID;
Command8.Parameters.Add("@IMAGEURL", SqlDbType.VarChar, 100).Value = QueryStringID + "\"" + CurrentID + "\"" + PhotoNumber.Text + ".gif";
Command8.Parameters.Add("@CAPTION", SqlDbType.VarChar, 200).Value = Caption.Text;
Command8.Parameters.Add("@MAIN", SqlDbType.Int, 1).Value = "0";
Command8.Parameters.Add("@DATE", SqlDbType.DateTime).Value = DateTime.Now;
Command8.Connection = NewPicatureCon;
Response.Redirect("~/HouseEdit/?id=" + QueryStringID + "&Edit=Rooms");
Label14.Text = "ERROR";
Thanks in advance. Si!
May 28, 2007 10:10 AM|Volcano_88101|LINK
I am not sure that I understand. Do you want to save the Image's width/height in the database?
If so you could add the following code AFTER you saved the file. Please note that filename woudl be defined as String fileName = Path.Combine(Server.MapPath(~/PictureThis/LandLords/"), CurrentID, QueryStringID, PhotoNumber.Text + ".gif");
Hope this helps. If not please further clarify your question. Thanks.
BmpWidth = Bmp.Width;
BmpHeight = BmpHeight;
May 31, 2007 01:51 PM|blink18jew|LINK
Well i was going to resize the image based on if it was tooo big it would be resized by a code, but i think thats going to be ineffiecent and could potentually ruin some of the images, so im now trying to make the image a thumbnail when it uploads. Do you
know how to do it? I want it to basically redraw the image and make the longer size a set size, like the microsoft photo example project in the "downloads" section of this site but the codes classes are a bit "over my head" does anyone know / can break it
down for me? would be greatly appriciated. Si!
May 31, 2007 01:52 PM|blink18jew|LINK
oh i will not be saving the image to a database, i will have them upload to a file on my server. thanks again.