Click here to Skip to main content
15,891,607 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
friends,

i would like to develop a gallery page that already 50 % completed but i have images in binary format , i displayed all the images , but i want when i click on image button it will shows the full length ...so how can i write a code for that please tel me..... already using some jquery but it's shows binary number..leave it that...so please help me
ASP.NET
<asp:DataList ID="dl_testimonials" Height="550px" CellSpacing="2" CellPadding="1"    Width="100%" RepeatLayout="Table" RepeatDirection="Horizontal" RepeatColumns="4"   runat="server">
   <ItemTemplate  >
       <div id="dl_galitmback">
        <asp:ImageButton ID="img_testiuser" CssClass="img_gallery" ImageUrl='<%# "getgalleryimg.aspx?id="  + Eval("gid") %>' rel="prettyPhoto[pp_gal]"   runat="server" />

<%--<a href='<%# "getgalleryimg.aspx?id="  + Eval("gid") %>'  rel="prettyPhoto[pp_gal]" title="'<%#Eval("caption") %>">
       <img src='<%# "getgalleryimg.aspx?id="  + Eval("gid") %>' width="60" height="60" alt='<%# Eval("displayname") %>' />
</a>--%>

       </div>
   </ItemTemplate>
</asp:DataList>
Posted
Updated 19-Dec-15 1:56am
v2
Comments
Sergey Alexandrovich Kryukov 19-Dec-15 5:49am    
Full length of what? What's the problem? It your post even a question?
—SA
Dave Kreskowiak 19-Dec-15 10:33am    
EVERY file is "binary" so what you've said about that means nothing.

Are you showing a thumbnail image and when the user clicks it you want to show the full size image?
Member 10575434 20-Dec-15 23:07pm    
yes..i want that please help me..
Suvabrata Roy 21-Dec-15 3:43am    
I think you already have the full image, but that control is showing images in thumbnail view
Member 10575434 21-Dec-15 5:44am    
i am done for show image i want to display the image to thubnail view like model popup with next and previous buttons...

1 solution

Hi,

Every file is binary content as @Dave-Kreskowiak said, Now you need to specify your web browser by their application type and browser will render it.

So If you already have binary of that image then write a web Method which will return that binary data as an image, that function will take a id and return the image, now you will set that data to that particular image Tab e.g : <img src="data:image/bmp;base64,xxxxxxxxxxxxx...">

How to write an web method?
Example : http://stackoverflow.com/questions/10127937/calling-a-pages-webmethod-from-javascript-on-a-different-page[^]

How to return image using web Method?

C#
[WebMethod]
[return:XmlElement("imageData", DataType="base64Binary")]
public byte[] CreateImage()
{
using(Bitmap image = new Bitmap(100, 100))
using(Graphics imageGraphics = Graphics.FromImage(image))
{
imageGraphics.FillRectangle(Brushes.Red, 0, 0, image.Width, image.Height);
imageGraphics.DrawRectangle(Pens.Blue, 0, 0, image.Width, image.Height);

using(MemoryStream stream = new MemoryStream())
{
image.Save(stream, ImageFormat.Png);

stream.Flush();

return stream.ToArray();
}
}
}


Another Article which will help you : Submit Images to Web Service and Get Them Back[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900