Ive created a realestate application that allows the agent to upload photos along with a description of the estate, price, bedrooms and financial options. On the buyers side ive used a forms view to enable a viewer to browse through records and display images directly from the database.
Everything seems to be working fine but what id really like to do is have the ability to click on a thumbnail version of the images in order to display a much larger image in either a seperate window or table.
How can this be acomplished? Can I use client-side javascript or visual basic programming on the server side? Please help. Ive displayed my code below:


<asp:SqlDataSource ID="names" runat="server" ProviderName="System.Data.SqlClient"
ConnectionString="<%$ConnectionStrings:Monday %>" SelectCommand="SELECT person_image1, person_image2, person_image3 From people" />


<asp:FormView ID="FormView" runat="server" DataSourceID="names" AllowPaging="true">
<ItemTemplate>
<asp:ImageButton id="thumb" runat="server" Height="150" Width="200" ImageUrl='<%# Eval("person_image1") %>'
<asp:ImageButton id="thumb" runat="server" Height="150" Width="200" ImageUrl='<%# Eval("person_image2") %>'
<asp:ImageButton id="thumb" runat="server" Height="150" Width="200" ImageUrl='<%# Eval("person_image3") %>'/>
</ItemTemplate>
</asp:FormView>

Recommended Answers

All 3 Replies

Its built into .net
This is C# but same thing

//put your image path here
string imgPath = "";
System.Drawing.Image img = Image.FromFile(imgPath);


Image thumbnail = img.GetThumbnailImage(64, 64, new System.Drawing.Image.GetThumbnailImageAbort(ThumbnailCallback), IntPtr.Zero);

You must add the callback, but its not used.

Thank you for your interest but my images are stored as a file with the url stored in a database. How can I apply this code or any other code to my existing asp.net markup.
I am very new to asp and i apreciate your help please elaborate do that i can solve this issue.

If you have your images stored locally, then you might want to try to use Server.MapPath to load them.
Sample

//lets assume this path was returned from the database
Server.MapPath("~/images/filename.jpg")

then run the thumbnail code


there are quite a few ways to go about, a good way could to create a page that simplete does image processing like this
Here's a good link to check out.
http://www.codeproject.com/KB/aspnet/generate_thumbnail.aspx?display=Print

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.