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

  • SEARCH
  • Home
  • 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 6240363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:33:20+00:00 2026-05-24T11:33:20+00:00

Aim: To resize the images based on the resolution Problem : If we do

  • 0

Aim: To resize the images based on the resolution

Problem : If we do not resize, the alignment and image structuring will be gone

Need of the following code : I don’t want to resize a small images to 100% width.

    System.Drawing.Image img = System.Drawing.Image.FromFile(imgTest.Src);
    if (img.HorizontalResolution > 1000)
    {
        imgTest.Attributes.Add("width", "100%");
    }

Am I in the right way ? Or is there any other alternatives to do the same ? Let me know, can I replace the C# code using any CSS ?

  • 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-24T11:33:21+00:00Added an answer on May 24, 2026 at 11:33 am

    Can you be more specific?

    Basically are you storing the image somewhere in the new size?

    Or do you simply wish to show the image inside a DIV or td which needs to be of a certain width / height?

    And if I understand you right, you are just looking to resize larger images, so anything below a threshold should not get resized, right?

    If it is simple for display, you can ditch all of this and just use CSS

    img
    {
       max-width:1000px;
       max-height:1000px;
    }
    

    This will make any image that exceeds either of these constraints smaller but with fixed aspect ratio.

    This link explains the basics of these CSS properties http://www.w3schools.com/cssref/pr_dim_max-height.asp

    Let me know if this was helpful! Cheers!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There's a status indicator code for AIM which returns two different images depending on
My Aim is to append text on the images and save the image. I
I'm using authorize.net AIM, the sample code they provide prints an ordered list of
I am using this site. Aim : I want to move my footer based
I am using PHP to iterate over the following result set, the aim is
Aim: Calling a very slow stored procedure (with parameters) asynchronously from code behind of
I used the code from the following question to insert a YouTube video into
My aim is to have a simple, form based CMS so the client can
Aim :- to set background image in my application that fills the device both
My aim before writing this code was to just practice and learn more about

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.