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 645295
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T21:29:11+00:00 2026-05-13T21:29:11+00:00

I got a website which contains a lot of projects with each project containing

  • 0

I got a website which contains a lot of projects with each project containing a sidebar.

In this sidebar it is possible to attach images to a project. The images attached will be shown in a gallery with 3 small thumbs at the bottom and one bigger image at the top of the gallery. The big image will refresh to another image when a visitor clicks on the small thumb @ the bottom of the gallery.

The thumbs are no problem, they are shown correctly.

My problem is the bigger image at the top of the gallery. The images that get uploaded have a big variety of sizes, while my holder has a width of 239 and height of 179. What would be the best way to scale the images so that they are shwon correctly to the visitors of the website?

Thanks Zapping (this code is usable for me):

int sourceWidth = imgToResize.Width;
   int sourceHeight = imgToResize.Height;

   float nPercent = 0;
   float nPercentW = 0;
   float nPercentH = 0;

   nPercentW = ((float)size.Width / (float)sourceWidth);
   nPercentH = ((float)size.Height / (float)sourceHeight);

   if (nPercentH < nPercentW)
      nPercent = nPercentH;
   else
      nPercent = nPercentW;

   int destWidth = (int)(sourceWidth * nPercent);
   int destHeight = (int)(sourceHeight * nPercent);
  • 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-13T21:29:11+00:00Added an answer on May 13, 2026 at 9:29 pm

    You can resize the image maintaining the aspect ratio and resave it. Or if you want to maintain the same image then you could find out new height and width, maintaining the aspect ratio, and apply it accordingly to the height and width properties of the img tag.

    You can use these to resize the image or find the height and width.
    http://snippets.dzone.com/posts/show/4336
    http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-saving-cropping-and-resizing

    you can try out something on panning as well in case you decide to keep the larger sized images
    How to zoom in and zoom out image using jquery?

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

Sidebar

Related Questions

I've got a website which contains the profile of users. I am now working
This February 14 my website got attacked by some malware code which comes to
I got a large PHP website which I'm now about to take care of.
I got a client which is website is under SSL only on the payment
Ive got the following code which I hacked together from website examples. It works
I've got a website project under version control that relies on files from an
I'm currently building a website which contains video material from a YouTube channel. The
The solution I'm building contains a whole lot of projects. One of them, Web,
I'm working on a website which handles large amounts of data. I have got
I've got a user control which contains a number of other user controls. I

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.