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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:17:14+00:00 2026-05-13T11:17:14+00:00

I need to make an image viewer: on the left there’s a resizeable TD

  • 0

I need to make an image viewer: on the left there’s a resizeable TD with the div and image/video. In the right TD there are comments. Images are resized so that those panoramic, with high aspect ratios, were viewable with a scroll bar (horizontal or vertical), but scroll bars were shown only when necessary. The issue is how to calculate the correct width/height.

Here’s the document structure I work with:

<table><tr>
   <td id="container" width="100%" style="height: 100%">
       <div id="frame" style="border: 7px solid; width: 200px; height: 150px; overflow: auto">
           <img id="content" src="..." />
       </div>
   </td>
   <td width="200">some comments</td>
</tr></table>

I want to resize #frame so that it were like min(size of #container, max(size of #frame, size of #content)). In other words, to resize it so that each dimensioned were maximized inside of #container, but there were no white space between #content and #frame.

I do this min(max…) calculation on each dimension, taking into account borders, paddings, margins. But then it leaves scrollbars.

I try to check the difference between clientHeight & style.height and add the difference if #frame is still smaller than #container. But this isn’t quite reliable because of scrollbars that disappear alone or together.

Is there any existing solution?

  • 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-13T11:17:14+00:00Added an answer on May 13, 2026 at 11:17 am

    I came to the following solution:

    1. figure out the size of the element, of it’s decorations, the available space
    2. resize the container to the content size, but no more than parent
    3. if the container is smaller than the desired size, this means there are scrollbars, so the other dimension needs extension. Try to expand it.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to make an image viewer that allows large images to be loaded
I need to make this effect with php. I know that there is IMG_FILTER_PIXELATE
My problem is this: I need to make a JQuery Image slider that resembles
I need to make an online image resizing program that uses the Lanczo's Algorithm,
I need to make a list view with an image on left, a title
I need to make a condition with PHP that checks if an image is
I need to make a GET request that requires oauth, for and image to
I have a image field in the model. I need to make two copies(resized)
ok i need to make a whole background image so that it resizes with
I need to make a layout that looks like this: [250px - fixed div]

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.