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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T10:19:46+00:00 2026-05-11T10:19:46+00:00

In an HTML window, I am setting a custom body <img src=file://[filename]> to display

  • 0

In an HTML window, I am setting a custom body

<img src='file://[filename]'> 

to display an image.

Now I want to strectch the image to fit the available window, but preserve aspect ratio.

<img src='file://[filename]' width='100%' height='100'> 

stretches but also distorts the image.

Is there some HTML trickery to do that? IE only solution is fine, since this is in a hosted broweser control.

  • 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. 2026-05-11T10:19:46+00:00Added an answer on May 11, 2026 at 10:19 am

    If you want to preserve aspect ratio, you only need to specify one dimension ie:

    <img src='file://[filename]' width='100%' alt='' /> 

    You can use javascript to determine max dimension and resize accordingly

    <script type='text/javascript'> function getImgSize(id){ var pic = document.getElementById(id); var h = pic.offsetHeight; var w = pic.offsetWidth; alert ('The image size is '+w+'*'+h); } </script> 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there some clever content-type setting that makes Firefox display highlighted HTML source code
I have an offline html file that generates and saves a CSV by setting
I've got a popup window that looks like this Now I want to top
I want to wrap an image into an HTML div and since I want
I'm trying to display a local PDF file in a WebBrowser-Control. I didn't want
http://www.codinghorror.com/blog/2008/04/setting-up-subversion-on-windows.html I am following this as a guide to install subversion. The tutorial at
I was reading this article on Coding Horror: http://www.codinghorror.com/blog/2008/04/setting-up-subversion-on-windows.html I went to the downloads
popup.html is popped up by script from parent.html: window.open('popup.html', '', 'width=520, height=300,left=500,top=0'); Is it
I'm trying to get the height of a html window's content. This is the
Here's my full, latest code that doesn't work. Here's the main window HTML <!DOCTYPE

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.