Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3332540
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T23:41:57+00:00 2026-05-17T23:41:57+00:00

I am retrieving an image from SQL Server to display on a new page

  • 0

I am retrieving an image from SQL Server to display on a new page in my ASP.NET 4.0 application using this method (one of my posts):

How to display an image based on SelectedValue in a GridView?

I am then displaying the image in a new window using this method: (one of my posts):

How to display an image in a new window

What I am trying to do is get the height and width of the image so that the new window is created with the same height and width as the stored image. I guess there are two ways of doing this:

  1. Create a height and width column in my database and store the values when the image is inserted into the database
  2. Retrieve the image from the database and calculate somehow the height and width just before displaying it and then resize the browser window to the right size.

I already have over 150 images in the database so that makes option 1 difficult because I would have to go back over my db and calculate height and width for images that are already in the db. Therefore I would prefer to use option 2, or maybe there’s another option? How would I go about doing this?

Thanks for looking.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T23:41:57+00:00Added an answer on May 17, 2026 at 11:41 pm

    Something like:

    System.Drawing.Image image = System.Drawing.Image.FromStream( 
        new System.IO.MemoryStream((byte[]) SqlReader["img_data"]) 
    );
    
    int width = image.Width;
    int height = image.Height;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am retrieving an image from the SQL database into Byte() variable in VB.NET.
I have been trying to display image from database using php but i am
When retrieving a lookup code value from a table, some folks do this... Dim
I've encountered a problem when retrieving a JSONP response from a server in a
i have copied image from UIwebView using clipboard and i want to mail it.For
I am retrieving a captcha image from the Java based package SimpleCaptcha On the
When retrieving objects from an NSMutableArray in cocoa-touch is the below code ok? Should
When retrieving values from a DataRow is it better to use the column name
What is the Ruby idiomatic way for retrieving a single character from a string
Are there performance issues when retrieving and filtering data from views than from tables

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.