FormView Image control - asp.net

Hi i am currently working in Asp.net using C# language.
Please any one tell me how to show picture that are stored server table(data type image) in asp:image control.
thanks.

You'll have to save the image in some folder on your website, and use a URL to link to that image. Since this is going to be done for every request, I'm guessing you can understand this is not a best practice.
The correct way to do this is save all images in a single directory on your website, and in the DB only store the URL for that image.

Related

optimize and best practice for image call each time

I have client code for large project, their logo is on master page, which he updates weekly.
I have to update the title, image path, etc. on all the server and also upload a new image on all servers, now he wants to automate this process.
What is the best way to accomplish this? I have thought about storing the information (including Image) in database with single record and each time client update this single record when they want. But on each page, the logo image will come from database. Is it ok or should we cache or some other option to reduce load each time? Can we update page(.aspx) file using filestream like we can update text file? because if I update aspx from code then we don't have call any SQL, just upload an image, update the title and other information in aspx page.
Very simple. If the client wants to update something on their own without requiring developer intervention, it needs to go in the database. You can of course add any caching or whatever you like so that it's not necessary to query the database each request.
The only other viable alternative would be giving the client access to the directory that has the logo and insist on a convention for the logo filename. The client can then simply upload a new logo with the same filename and nothing needs to change on the site.
Making changes to the page itself automatically is a hugely bad idea. Avoid that like the plague.
I suppose a final though not bloody likely option is to get the client to realize that a logo shouldn't freaking be changed weekly or even yearly. It's a freaking logo; it's your identifying mark to the public.

Multiple image upload with asp.net

How to upload multiple images to the web server with single button.I know there are couple of options available like flash,j query and silverlight.The problem is that there are many others things I want to do with images like upload the same image with different size (thumbnail) and want to change the image file name something like a GUID and want to store the path in database.
You can use uploadify.js for the same.
It is light weight as it contains jquery code.
Easy to implement.
Here is the link for the same. Uploadify

Web server instances?

Very newbie question, please forgive me:
I'm creating an asp.net website. I assume that when multiple people request the page each person gets a new instance of the site. However, if the site uses a .jpg image on the server and manipulates the image, does each person get an instance of the image also, or do they share the image somehow? I think I know, and that this is probably a dumb question, but I wanted to ask.
As an example: A user logs into the site, and adds times to a schedule. Depending on the schedule, a blue line is drawn on an image (grid.jpg), which depicts a daily timeline. The image is then saved as newgrid.jpg and displayed to the user. Is there a way for each user to get an instance of the image that only they can see?
A great way to generate dynamic images in ASP.NET is by using a Handler. The answer over here offers a good, simple example. In this scenario, the generated image never touches the local file system, it's just generated in memory, and returned to the client.
Well, usually the site is always the same for all users, but there are sessions created for each user with specific settings that you can set. So yes, all people will by default see the same changes (and the same content).

Web Application and Development

i have two pages:
1st page... let it be adminfileupload page
2nd page... home page(this will be site home page)
i have one folder in solution explorer named images.
what i want to do is
adminfileupload has one fileupload control and a button named update
when any one browse image file with file upload and click the button(update) then the image should be viewed in home page and also saved in images folder. each time we chose a file and click the button(update) the image should be changed. and this image should be background image, i mean i also have to show some data from database over that image.
working in c# asp.net
Do you need to keep the other pictures too?
If not, you could just upload a picture give it a fix name, Then in the home page you could just set the background image the path to the picture and the fix name. If you have trouble overloading the picture(does not write over you should delete the picture first).But this is a simple approach and depending on the browser you test on it might keep the first picture in their temp file.
If you want to keep the other images you need to do some extra work and have a storing mechanism that will keep track of your pictures or a dynamic variable that changes the path of the resources. I sugest you take a look at the ASP.NET Personal Web Site Starter Kit It has a mechanism that implement a random picture on the first page but the pages are stored in sql database.
Happy coding
The best way I can think of to do this is on the button upload click event, store the file to the server folder. At the same time assign a Session variable the name of the file uploaded.
You will need to manage file names that get stored on the server or check if they already exist, or if different users upload the same file name, etc.
So Session("myImage") = currFileUploaded
Then do a Redirect back to the current page to show the image, which will link to the session variable that just stored the file name that was uploaded.
You'll need to check for a post back and hide or show the image as necessary.

flex - check image dimensions before upload using filereference

In my Flex application, I use a FileReferenceList that the user can populate with multiple files using fileList.browse() before upload.
I check each file's size and use fileList[i].upload() to upload to my server, this works fine.
I have a suspicion that this is not possible, but before upload I would like to convert each FileReference into an Image in order to check it lies within certain dimension tolerances.
I realise I can do this server side, but ideally I would like the check to appear on both client and server. Can anyone offer any help?
Thanks!
Take a look at this post at the Yahoo! Flash Blog. Flash 10 lets you work with images locally. They give a nice example with code of how you can process FileReference objects, specifically image files.

Resources