Web Forms :: Put Picture From Dtatabase To PictureBox?
Dec 21, 2010how to put picture from dtatabase to pictureBox in asp.net ?
View 2 Replieshow to put picture from dtatabase to pictureBox in asp.net ?
View 2 Repliesi have sql-server-2008 database that contain image field that hold picture.
i have pictureBox control in my webform.
how to put picture from database to pictureBox control ?
(I work with C# asp.net FW3.5)
can i get any sample code or program ?
I want to crop a picture in a picturebox by allowing the user to selecta rectangular region like you get in software like Photoshop.
Or User Will select a region in pircture box and then region will be saved as a individual picture.
Is it possible using C#.
i'm new to c# and i wanted to know how can i allow user to upload a picture from a text box and a button??
after uploading the picture, how can i save the picture in the database??
**note**the picture i allow user to upload need to be in a fixed size.
I have this code to insert a picture from database into an ImageControl on my ASP.NET form:
strConnString = "server=" + Server + ";database=" + DataBase + ";UID=" + UID + ";password=" + PASS + ";";SqlConnection MyConnection = new SqlConnection(strConnString);SqlCommand MyCommand = new SqlCommand("SELECT Pic FROM MEN WHERE ID=5", MyConnection);MyConnection.Open();SqlDataReader MyReader = MyCommand.ExecuteReader();if (MyReader.Read()){ byte[] m_MyImage = (byte[])MyReader["Pic"]; Response.BinaryWrite(m_MyImage);}
And I have this ImageControl on the form:
<asp:Image Width="88" Height="100" Runat="server" ID="m_Image" NAME="m_Image" />
but when I run the code, I see the picture big on the screen and not in my ImageControl.
i also put this in the form_load:
m_Image.ImageUrl = "MyPhoneBook.aspx?m_Image";my control is: m_Imagemy control ID is: m_Imagemy namespace is MyPhoneBook
but still dont work
I ve an application dat am working on. The section of the upload picture works perfectly on the development environment and also on a test server but the issue comes up when it was hosted life. I started geting an error dat says picture could not be attached. I ve a folder cald Passport and dis ve been working for me on befor now but i dont now the reason y its not working now.
protected void btnUpload_Click1(object sender, EventArgs e)
{
Boolean fileOK = false;
String fileExtension = string.Empty;
String path = Server.MapPath("~/Passport/");
if (fuPassport.HasFile)
{
fileExtension = System.IO.Path.GetExtension(fuPassport.FileName).ToLower();
String[] allowedExtensions = { ".gif", ".png", ".jpeg", ".jpg" };
if (allowedExtensions.Contains(fileExtension))
{
fileOK = true;
}
}
else
{
Utilities.PortalMessage = "Please attach an image file.";
return;
}
if (fileOK)
{
try
{..............................
I want to know, how can i open a picture from a web page to picture viewer like microsoft picture manager, when i click a button it should open a image in picture manager, picture is in one of my folders.
View 2 RepliesI am developing project using asp.net 2.0 and C#.net.I want to capture users picture or video from webcam and save it in a folder in Harddisk. how to develop this feature and if possible provide me reference links.
View 4 RepliesI have a webform with 2 Textbox (ID & Name), 2 grouped radio button (Male-female), and a Picturebox (Photo).
I need to display/Load Details into the given controls from the ID number. I am using VS2008 SP1, C# and MS SQL.
I build a website with management system. In the management pages, I can upload pictures to a specific folder in my website. While doing it in my localhost in works perfect. While doing it on the hosted site, I get: A generic error occurred in GDI+. I read a little bit about it, and relized that it is probably an authorization problem. I asked the hosting to let a iusr_xxx permition to that folder. I've just informed now that it was done. The problem still occures. Here is the problematic code. It falls on the save command:
using
{
bitmap.Save(MapPath("../images/lawyers/" + fileName), image.RawFormat);
}
I tried already to put GC.collect(); after this line and alse I tries bitmap.Disppose() after this line.
I want to rename the image when uploaded to server. How to get it Give me code if possible.
View 3 RepliesI let my users upload picture files from a VB6 project. I can filter out all but the common file types (.jpg, .gif etc.) when sending to the FTP.
Is there a way to open the files with Asp.Net, without knowing the specific file type. Like FileName.* or something?
Example- %%D1,100,0,0004[data...][0d0a]
[code]....
from the above example i want to extract picture data and need to store in to the sql table.sql table olumname is image and datatype is also image.after that i wanted to display this image column to an aspx page.
Using C#
How can i save a Div (tabel) in .aspx page as a Pic (jpeg or anything) ?
I'm trying to display the picture that i have saved using the fileUploadControl functions. so far my code can save the picture to the folder that I want but the picture does not appear on my webpage. I used the code at visual studio 2005 and it works totally find but when I put it at visual studio 2008 it doesn't work fully. can somebody teach me how to solve this problem?? is there a new updates at visual studio 2008 that i missed??
below are my codes.
[Code]....
in my web app i wanna use a fileupload control to upload a picture but i wanna to control picture widht and height before upload it.
how can i achieve this?
I am uploading images in c# windows application. I am uploading the images folder wise. In one folder there are 200 to 3000 images. My one images size is about 3.10 MB to 6.2 MB. Its dimensions are 3008 x 1960, 1960 , 4000 x 2600. 6000 x 4000 . while uploading i am reducing the size of image to 400 x 266 or 266 x 400 depending on the height and width of image. but still my image size is about 227 KB. Now i want to reduce the image resolution to decrease the image size.
My code is given below:
private void btnUpload_Click(object sender, EventArgs e)
{
getDestinationPath();
string ik = DestinationPath;
string ik2 = DestinationPath2;
string lastFolderName = Path.GetFileName(ik);
[Code] .....
I have 2 image button in my page
1-Imagebutton1
2-imagebutton2
I want when click on Imagebutton1 both of my image button picture (Imagebutton1 and imagebutton2) will be change .
i have a photo in client
i send the address photo from address bar to the form
but the image control can't show the photo
how can i show the photo from client
How to insert picture into DB from formview?
What control I have to use to locate picture and what technique to adopt.
My working enviornment is 2.0.
In database the table is already created with Binaryfield to store pictures.
I have a Report a Bug page added to a small site; I have a text box where a user can type a text that will be submitted to a table in my db; how do I implement the upload of a picture, let's say a screen capture? the most convenient way (for the user) would be to be able to press the Print Scrn button and then paste it to my text box ... well, I'm sure this won't work ...
View 2 Repliesi have a gridview with a upload control in edit template. and a image control in item template bound to page that gets the new uploaded picture.the trouble is it does not return a picture no matter what i try??
View 2 RepliesI had a problem before with GridView displaying picture and it was solve as post [URL] shows. I am trying to apply the same coding to another GridView with a different configuration and I am having a hard time making the adaptation. May someone take a look at it. What I am trying to add to this GridView is code as:
DataImageUrlFormatStringl='<%# IIF(System.IO.File.Exists(Server.MapPath(string.Format("~/UploadedImagesClassifieds/{0}{1}", Eval("AutoNumber"), "Pic1.jpg"))), string.Format("~/UploadedImagesClassifieds/{0}{1}", Eval("AutoNumber"), "Pic1.jpg"), "~/UploadedImagesClassifieds/NoPicture.gif")
%>'
And the GridView code is the following at the present time:
<
asp:GridView
ID="ClassifiedsDisplayGridView"
runat="server"
DataSourceID="srcClassifieds"
AutoGenerateColumns="False"
CellPadding="4"
ForeColor="#333333"
AllowPaging="True"
PageSize="100"
EnableSortingAndPagingCallbacks="true"
>
<Columns>
<asp:ImageField
DataImageUrlField="AutoNumber"
DataImageUrlFormatString="~/UploadedImagesClassifieds/{0}Pic1.jpg"
HeaderText="Picture"
ReadOnly="True"
>
<ControlStyle
Height="50px"
/>
</asp:ImageField>
<asp:BoundField
DataField="Category"
HeaderText="Category"
/>
<asp:HyperLinkField
DataNavigateUrlFields="AutoNumber"
DataNavigateUrlFormatString="~/Classifieds/DetailPage.aspx?AutoNumber={0}&FlagForm=NoSubmitted"
DataTextField="ItemTitle"
HeaderText="Listing
Title" />
<custom:LongTextField
DataField="ListingComment"
Width="400px"
Height="75px"
HeaderText="Listing
Comment" HtmlEncode="false"
/>
<asp:BoundField
DataField="EnterDate"
HeaderText="Listed
on" SortExpression="EnterDate"
/>
<Columns>
<FooterStyle
BackColor="#00693E"
Font-Bold="True"
ForeColor="White"
/>
<RowStyle
BackColor="#FFFBD6"
ForeColor="#333333"
/>
<PagerStyle
BackColor="White"
ForeColor="#333333"
HorizontalAlign="Center"
/>
SelectedRowStyle
BackColor="#FFCC66"
Font-Bold="True"
ForeColor="Navy"
/>
<HeaderStyle
BackColor="#00693E"
Font-Bold="True"
ForeColor="White"
/>
<AlternatingRowStyle
BackColor="White"
/>
<PagerSettings
Mode="NextPreviousFirstLast"
Position="TopAndBottom"
/>
</asp:GridView>
<asp:ObjectDataSource
ID="srcClassifieds"
TypeName="SearchUtility"
SelectMethod="GetClassifiedsSimpleSearch"
runat="server"
OnSelected="srcClassifieds_Selected"
EnableViewState="False">
<SelectParameters>
<asp:QueryStringParameter
Name="Category"
QueryStringField="Category"
Type="String"
/>
<asp:QueryStringParameter
Name="Activity"
QueryStringField="Activity"
Type="String"
/>
<asp:QueryStringParameter
Name="KindOfSearch"
QueryStringField="KindOfSearch"
Type="String"
/>
<asp:CookieParameter
CookieName="Country"
Name="Country"
Type="String"
/>
<asp:CookieParameter
CookieName="CityTown"
Name="CityTown"
Type="String"
/>
<asp:SessionParameter
Name="State"
SessionField="State"
/>
<asp:Parameter
Direction="Output"
Name="SelectRows"
Type="Int64"
/>
</SelectParameters>
</asp:ObjectDataSource>
How can I check the resolution of a remote picture (jpg, gif) using the URL of the picture rather than a locally stored picture?
I attempted this, but get an error.
[Code]....
I have a folder with pictures (EmpID.jpg).... When datagrid is returned containing an EmpID, name, address, etc... I want to get the matching picture from folder which resides on server not located within the application itself.
View 3 Replies