none
Get File Information RRS feed

  • Question

  • Hello, everyone.  I am creating a photo application that uploads the file information, such as the pixels, and the filename to a SQL server and I would like to be able to create a control that would capture this information directly from the file.

     

    For example, a jpeg file named AN_0876.jpg with a dimension 2304x3246 pixels (visible when the mouse hovers over the file). 

     

    Is there a way to capture that information?

     

    Thanks,

     

    Antonio

    Sunday, April 29, 2007 8:12 PM

Answers

  • Please use the following code.

     

      protected void Page_Load(object sender, EventArgs e)
        {

          string name = this.Image1.ImageUrl;
            double height =this.Image1.Height.Value;
            double width = this.Image1.Width.Value;
            string fileInfo = name + ":" + Convert.ToString(width) + " x " + Convert.ToString(height);
            this.Image1.AlternateText = fileInfo;
        }

    Monday, April 30, 2007 9:56 AM
  • Hi, Antonio

    If you referred to Winform one, try to use the following code:

    Code Snippet

              string str = pictureBox1.Image.Size.Width.ToString() +"*"+ pictureBox1.Image.Size.Height.ToString();
                toolTip1 = new ToolTip();

                // Set up the delays for the ToolTip.
                toolTip1.AutoPopDelay = 5000;
                toolTip1.InitialDelay = 1000;
                toolTip1.ReshowDelay = 500;
               
                toolTip1.SetToolTip(pictureBox1,str);
                toolTip1.ShowAlways = true;

     

    Thanks

     

    Tuesday, May 1, 2007 3:44 AM

All replies

  • Please use the following code.

     

      protected void Page_Load(object sender, EventArgs e)
        {

          string name = this.Image1.ImageUrl;
            double height =this.Image1.Height.Value;
            double width = this.Image1.Width.Value;
            string fileInfo = name + ":" + Convert.ToString(width) + " x " + Convert.ToString(height);
            this.Image1.AlternateText = fileInfo;
        }

    Monday, April 30, 2007 9:56 AM
  • Hi, Antonio

    If you referred to Winform one, try to use the following code:

    Code Snippet

              string str = pictureBox1.Image.Size.Width.ToString() +"*"+ pictureBox1.Image.Size.Height.ToString();
                toolTip1 = new ToolTip();

                // Set up the delays for the ToolTip.
                toolTip1.AutoPopDelay = 5000;
                toolTip1.InitialDelay = 1000;
                toolTip1.ReshowDelay = 500;
               
                toolTip1.SetToolTip(pictureBox1,str);
                toolTip1.ShowAlways = true;

     

    Thanks

     

    Tuesday, May 1, 2007 3:44 AM