473,320 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

How can we protect the photo's proportion in web site?

This one just auto size the width
But how can we auto size the height?
Expand|Select|Wrap|Line Numbers
  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2. <head>
  3. #Refresh#
  4. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  5. <title></title>
  6. <style type="text/css">
  7. <!--
  8. body {
  9. font-size: 12px;
  10. text-align: center;
  11. margin: 0;
  12. padding: 0;
  13. }
  14. #pic{
  15. margin:0 auto;
  16. width:100%;
  17. padding:0;
  18. border:0px solid #333;
  19. }
  20. #pic img{
  21. max-width:100%; mywidth:expression(onload=function(){
  22. this.style.width=(this.offsetWidth >document.getElementById("pic").scrollWidth*8/10)? "100%": "auto"});
  23.  
  24. border:1px dashed #000;
  25. }
  26. -->
  27. </style>
  28.  
  29.  
  30. </head>
  31. <body>
  32. <div id="pic">
  33. <img src="#PARAM1#" >
  34. </div>
  35. </body>
  36.  
  37. </html>
  38.  
Mar 18 '10 #1
1 1084
gits
5,390 Expert Mod 4TB
this will only work in IE ... and what is your exact question? you already have the logic and just need to set
Expand|Select|Wrap|Line Numbers
  1. this.style.height
additionally in your expression.

kind regards
Mar 19 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Slatek | last post by:
Mam problem ze skryptem Coppermine Photo Gallery. Jak usun±æ info: Powered by Coppermine Photo Gallery na dole galerii.
2
by: Eric McDaniel | last post by:
I am trying to read in a bunch of images and manipulate them using Image::Magick, then display them using Tk::Photo. I would like to do this without creating a temp file for each image, since there...
11
by: siliconmike | last post by:
Is there a way to protect data files from access by root ? I have a data-centered website and would like to protect data piracy from any foot-loose hosting company employee. Any ideas? ...
15
by: Fady Anwar | last post by:
Hi while browsing the net i noticed that there is sites publishing some software that claim that it can decompile .net applications i didn't bleave it in fact but after trying it i was surprised...
3
by: bob garbados | last post by:
I'm looking for thoughts on photo galleries and security/performance implications... I'm working on an asp.net site in vb that will include an updateable photo gallery that will display thumbnails...
7
by: Eric Lindsay | last post by:
I would like to do a photo gallery with a liquid layout. I wanted to center a caption below each photo (or above each photo). I can do that easily with tables, but then I don't have a liquid...
13
by: Viken Karaguesian | last post by:
Hello everyone, Can anyone recommend a good online site to learn PHP? The W3Schools website is quite lacking - leaves much to be desired. I'm sure there are many places, but which ones are good?...
1
by: Throw | last post by:
G'day everyone I'm looking for a simple photo gallery script in PHP (or Perl), but not too simple. I have tried several photo gallery scripts in either language and I have found that they are...
4
by: MC | last post by:
I am looking for a .js photo zoom. I saw a site that had a nice one that did expanded gradually and was really nice. I bookmarked the site but now the site is gone. Any other sites with nice...
1
by: cumupkid | last post by:
II am trying to create a form that will allow me to upload photos to a folder in the site root directory and add the information to the mysql db at the same time. I have created two forms, one...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.