This is a migrated thread and some comments may be shown as answers.

RadBinary image Displays the Orginal Image Size.

19 Answers 167 Views
BinaryImage
This is a migrated thread and some comments may be shown as answers.
Velkumar
Top achievements
Rank 2
Velkumar asked on 02 Nov 2011, 11:47 AM
Hi

               I have a RadAsyncUpload to upload the image. Using  another button named "UpLoad" generate the postback to upload the image.  Save the image in sql Server database in binary format. Retrieve the binary data from the database and set it to the datavalue property of the RadBinary image control. The radbinary image displays the image in it's original size.  I have set the width and height of the radbinary image as 200px but the the image is displayed in its original size.
 If i will generate a postback again then the image is set in 200px height and width. Please give the solution for this problem.
protected void Page_Load(object sender, EventArgs e)
        {
 
            binaryimage1.Height = Unit.Pixel(200);
            binaryimage1.Width = Unit.Pixel(200);
       
            b1.Click += new EventHandler(b1_Click);
 
        }
void b1_Click(object sender, EventArgs e)
        {
 
            foreach (Telerik.Web.UI.UploadedFile file in uploader.UploadedFiles)
            {
                byte[] bytes = new byte[file.ContentLength];
                string fname = file.FileName.ToString();
                int length = bytes.Length;
 
                file.InputStream.Read(bytes, 0, file.ContentLength);
 
                SqlConnection dbconn = new SqlConnection(strconn);
 
                try
                {
                    string Query = "INSERT INTO RadBinaryImageDemo (ImageData,ImageName) VALUES " + " (@imgdata,@imgname)";
                    SqlCommand cmd = new SqlCommand(Query, dbconn);
 
                    SqlParameter[] param = new SqlParameter[2];
 
                    cmd.Parameters.AddWithValue("@imgdata",bytes);
                    cmd.Parameters.AddWithValue("@imgname", file.FileName);
                    dbconn.Open();
                    cmd.ExecuteNonQuery();
                   
                    DataTable d1 = new DataTable();
                    string Query1 = "select ImageData from   RadBinaryImageDemo where ImageName='" + fname + "'";
                    SqlDataAdapter sqldadap = new SqlDataAdapter(Query1, dbconn);
                    sqldadap.Fill(d1);
 
                    byte[] imgdata = ((byte[])d1.Rows[0]["ImageData"]);
 
                    binaryimage1.DataValue = imgdata;
                     
                }
                finally
                {
                     
                        dbconn.Close();
                     
                }
            }
 
             
        }

19 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 02 Nov 2011, 12:25 PM
Hi Velkumar,

Can you try setting the width and height properties in the button click event handler, just after setting the DataValue property and see if it makes any difference? You can also try altering the RadBinaryImage ResizeMode to Fit or Crop.
If the issue persists, try downloading the latest internal build and let me know how it goes.

Greetings,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Velkumar
Top achievements
Rank 2
answered on 02 Nov 2011, 12:54 PM
Hi,
                 

               Now i m using ResizeMode as fit . If the ResizeMode is Fit then the image displayed not in the given size(200 x 200). If a click the button for uploading then the image displayed not in the given dimension. If i generate the postback again then the image will be set in the given dimension (200 x 200). I attached both the screen shots. See the difference. If the width and height is set after setting datavalue no difference will occur.
Give the solution for this problem.

By
Er.Velkumar B.E  
0
Iana Tsolova
Telerik team
answered on 02 Nov 2011, 02:51 PM
Hello Velkumar,

Could you please open a formal support ticket and send us a sample illustrating the issue? I will forward it to our developers for further investigation.

Kind regards,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Velkumar
Top achievements
Rank 2
answered on 03 Nov 2011, 12:31 PM
Hi

                  Give the solution for this problem through this forum.
0
Iana Tsolova
Telerik team
answered on 03 Nov 2011, 12:45 PM
Hi Velkumar,

To solve the issue, we will need to replicate it. Can you send us a runnable project for the purpose?

Kind regards,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Velkumar
Top achievements
Rank 2
answered on 03 Nov 2011, 01:39 PM
Hi

    I posted the c# code already.
   Now post the aspx code below.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="BinaryImage1.aspx.cs" Inherits="BinaryImage1_Default" %>
 
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
         
        <asp:Label ID="heading" Text="Using Binary Image" runat="server"></asp:Label>
     
     
        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
        </telerik:RadScriptManager>
     
     
    <table>
    <tr>
        <td>
            <telerik:RadAsyncUpload ID="uploader"   runat="server" ></telerik:RadAsyncUpload>
        </td>
    </tr>
        <tr>
            <td>
                <telerik:RadBinaryImage ID="binaryimage1"  runat="server" />
            </td>
        </tr>
        <tr>
        <td>
            <asp:Button id="b1" Text="PostBack" runat="server" />
        </td>
        </tr>
        <tr>
            <td>
                <asp:Image ID="imagedisp" runat="server" />
            </td>
        </tr>
 
        <tr>
            <td>
            <asp:Button ID="b2" Text="Again PostBack" runat="server" />
            </td>
        </tr>
         
    </table>
    </div>
    </form>
</body>
</html>

0
Velkumar
Top achievements
Rank 2
answered on 03 Nov 2011, 01:41 PM
Hi
     How can i upload  my project.
0
Iana Tsolova
Telerik team
answered on 03 Nov 2011, 04:16 PM
Hi Velkumar,

You can add the project to a zip file and attach it to your posts in the Support thread.

All the best,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Velkumar
Top achievements
Rank 2
answered on 04 Nov 2011, 03:51 AM
Hi
            Please give the link to upload my project in Zip.
           
            Just copy the above asp.net and C# codes and develop a new project to illustrate the issue.

Thanks,
Er.Velkumar
0
Iana Tsolova
Telerik team
answered on 04 Nov 2011, 06:49 AM
Hi Velkumar,

You have already open a formal Support Ticket for the same issue, right? Then post reply to the ticket and attach the runnable sample in a zip file there.
Using the code you provided to build up a sample is not enough, the referred database is necessary as well.

All the best,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Velkumar
Top achievements
Rank 2
answered on 04 Nov 2011, 10:49 AM
Hi

              I attached my project in the support ticket. Please give the solution for this problem.

Thanks,
Er. Velkumar
0
Iana Tsolova
Telerik team
answered on 04 Nov 2011, 10:57 AM
Hello Velkumar,


Thank you for the cooperation. We will check it out and let you know of our progress in the support thread shortly.

Regards,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Velkumar
Top achievements
Rank 2
answered on 04 Nov 2011, 11:16 AM
Hi

           Thank You So much.

Thanks,
Velkumar
0
Velkumar
Top achievements
Rank 2
answered on 15 Nov 2011, 06:28 AM
Hello

                I will check the steps provided in support ticket and send the feed back to you.


Thanks
Velkumar
0
Velkumar
Top achievements
Rank 2
answered on 17 Nov 2011, 12:22 PM
Hello,

   Now Image not resized on postback but some images displayed in different width and height. I am providing 300x300 but the size will vary for some images.


Thanks,
Velkumar.
0
Iana Tsolova
Telerik team
answered on 18 Nov 2011, 09:52 AM
Hi Velkumar,

Can you specify what is the original size for such an image and what is its size afterwards? Sending such an image for tests, would be great.


Greetings,
Iana Tsolova
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Velkumar
Top achievements
Rank 2
answered on 18 Nov 2011, 11:31 AM
Hi

       I attached the folder which contains the images in my Support ticket. Please check by using all the images in the folder.


Looking forward your reply,
Thanks,
Velkumar.
0
Velkumar
Top achievements
Rank 2
answered on 22 Nov 2011, 10:32 AM
Hi

        Please give the solution for this problem.

Thanks,
Velkumar
0
danny lankar
Top achievements
Rank 1
answered on 23 Mar 2012, 02:46 PM
I need the answer to this question too please. did this get resomved?
Tags
BinaryImage
Asked by
Velkumar
Top achievements
Rank 2
Answers by
Iana Tsolova
Telerik team
Velkumar
Top achievements
Rank 2
danny lankar
Top achievements
Rank 1
Share this question
or