HTML - Auto Resize Image?
I am having a problem with images that vary in size. I let the user upload images and then display it on a web page. The problem is that the images that the users submit are different sizes. Some look good while others look distorted. Any Ideas?
Similar TutorialsHi, So i need some help. I hope i post this at the right place. I'm making a website, and i want the iframe to have auto resize, because the first page is a news page, and will therefor end up being pretty long, i dont want a scroll bar inside the iframe because i dont like the way it looks. I found a javascript thing that helped with i resize, the iframe extends if the news page gets longer with the news i post. BUT. if i go to any other page on the website, the iframe keeps the first pages height, and i dont want that, i want it to "shrink" and be as long as the information inside the iframe. this is the website right now, far from done by the way. http://martin.scorpionshops.com/spwebsite/index.html and as you can see the height of the iframe stays the same if you klick on any of the links in the menu, is there a way to fix this? this is the code that ive applied to the iframe and such on the index page where the iframe is located <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link rel="stylesheet" type="text/css" href="stylesheet.css" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>SimplePlanWorldwide</title> </head> <body topmargin="0" link="black" vlink="black" alink="black"> <script language="JavaScript"> <!-- function autoResize(id){ var newheight; var newwidth; if(document.getElementById){ newheight=document.getElementById(id).contentWindow.document .body.scrollHeight; newwidth=document.getElementById(id).contentWindow.document .body.scrollWidth; } document.getElementById(id).height= (newheight) + "px"; document.getElementById(id).width= (newwidth) + "px"; } //--> </script> <div align="center"> <table width="1024" border="0" cellpadding="0" cellspacing="0"> <tr> <td colspan="4" background="header.jpg" height="294" border="0"> </td> </tr> <tr> <td colspan="4" height="65" border="0"><img src="menu.jpg" border="0" usemap="#Map2"></img></td> </tr> <tr> <td width="227" height="108" background="welcome.jpg" border="0"><p><font size="1" face="arial narrow" vlink="black" hlink="black" color="#ffffff"><br> Welcome to SimplePlanWorldwide!<br> SimplePlanWorldwide.com is a fansite for Simple Plan <br> and we are here to give you the latest about the band<br> and feed your Simple Plan cravings. Enjoy!</font></p></td> <td width="196" height="108" background="sitestats.jpg" border="0"><font size="1" face="arial narrow" vlink="black" hlink="black" color="#ffffff" valign="left"><br> <B>Owner:</B> Matilda | About <br> <B>Launched:</b> 2012.30.05 <br> <b>Layout:</b> Version 1.0<br> <b>Like this site?</b> Bookmark us!</font></td> <td width="204" height="108" background="disclaimer.jpg" border="0"><p><font size="1" face="arial narrow" vlink="black" hlink="black" color="#ffffff"><br> SimplePlanWorldwide is not affiliated with the <br> band, Simple Plan, Pat, Frenchie, Atlantic Records</font><font size="1" face="arial narrow" vlink="black" hlink="black" color="#ffffff"><br> or Lava Records, and we don't know the guys<br> personally. We're just a fansite for SP.</font></p></td> <td><img src="linksofficial.jpg" width="397" height="108 border=" border="0" usemap="#Map"0"></td> </tr> </table> <table width="1024" border="0" cellpadding="0" cellspacing="0"> <tr> <td valign="top" witdh="755" background="mainbackground.jpg" border="0" repeat="norepeat"><br> <center><iframe align="top" SRC="news.php" width="100%" height="200px" name="iframe1" id="iframe1" marginheight="0" frameborder="0" onLoad="autoResize('iframe1');"></iframe></center> </td> <td valign="top" width="269" background="sidebackground.jpg" border="0"> <div class="twitter"> <center><br> <script charset="utf-8" src="http://widgets.twimg.com/j/2/widget.js"></script> <script> new TWTR.Widget({ version: 2, type: 'list', rpp: 8, interval: 30000, title: '', subject: 'SIMPLE PLAN TWEETING', width: '250', height: 700, theme: { shell: { background: 'transparent', color: '#999999' }, tweets: { background: 'transparent', color: '#444444', links: '#000000' } }, features: { scrollbar: false, loop: false, live: true, behavior: 'all' } }).render().setList('matildawr', 'simple-plan').start(); </script> </div></td> </tr> </table> <map name="Map" id="Map"> <area shape="rect" coords="7,22,151,77" href="http://www.simpleplanfoundation.org" target="_blank" alt="map" /> <area shape="rect" coords="164,13,226,100" href="http://www.officialspcrew.com" target="_blank" alt="map" /> <area shape="rect" coords="236,23,388,82" href="http://www.merchdirect.com/simpleplan" target="_blank" alt="map" /> </map> <map name="Map2" id="Map2"> <area shape="rect" coords="86,6,148,42" href="news.php" target="iframe1" alt="menumap" /> <area shape="rect" coords="190,7,331,40" href="information.html" target="iframe1" alt="menumap" /> <area shape="rect" coords="372,7,434,40" href="tour.html" target="iframe1" alt="menumap" /> <area shape="rect" coords="610,6,738,41" href="multimedia.html" target="iframe1" alt="menumap" /> <area shape="rect" coords="772,5,833,38" href="www.html" target="iframe1" alt="menumap" /> <area shape="rect" coords="474,6,568,38" href="http://martin.scorpionshops.com/spwebsite/forum/" target="_blank" alt="gallerymap" /> </map> </body> </html> So.. do you have any ideas? I dont know much css or javascript, or php for the matter, but i am willing to learn to make it work, so ANY methods that will make this work, just help me I don't know if this question is posted somewhere, but I can't seem to find the answer I'm looking for. I'm currently using iframe for my posting entries, and I can't figure out the script for auto height. I'm tired of setting the height by hand, every time my entries starts to stretch. Now regarding the width, would that be possible too? if not, I'm not too concerned. Most important is the height. If anyone have the answers to this please reply. Thanks in advance! (: Hello! I am pretty new to HTML, but I was asked to make a webpage for my girlfriend's small business. What I want to do is copy the style used on the main image of this website: http://www.stellamccartney.com/. What I am looking to do is take an image and have it resize whenever I resize the browser window. If you can tell, the image is actually zooming in and out in order to maintain its correct ratio. I am not interested in copying anything else from this website, only the way the main image works. Looking at the source code has me baffled; I believe they wrote this using javascript, but I can't tell. If anyone knows how to create a similar effect as this site I would greatly appreciate the help. Thank you! Evening all, I'm looking for some simply coding to tell an image to resize to fit into a frame that is defined in the CSS layout. The image size needs to be reduced to 630x402, the original size is much greater. <SCRIPT LANGUAGE="JavaScript"> var theImages = new Array() theImages[0] = 'images/main_img.jpg' theImages[1] = 'images/main_img2.jpg' theImages[2] = 'images/main_img3.jpg' theImages[2] = 'images/main_img4.jpg' var j = 0 var p = theImages.length; var preBuffer = new Array() for (i = 0; i < p; i++){ preBuffer[i] = new Image() preBuffer[i].src = theImages[i] } var whichImage = Math.round(Math.random()*(p-1)); function showImage(){ document.write('<img src="'+theImages[whichImage]+'">'); } </script> <div id="main_img"><SCRIPT LANGUAGE="JavaScript">showImage();</script></div> I need someway of implementing the size change into the coding somewhere. Thank you for any help in advance! Hi All, We have images which are displayed in panel series. We have images if all sizes and width, we have tried using width=100% which makes all the images to fit the width allotted, which makes the image BLUR if the image is very small. Is there a way by which we can have width=100% for only the oversize images and leave the others as it is. Regards, Nagesh I am looking for an easy code that when applied will resize an image link. I am trying to get around code that swaps one image for another on mouseover. I just want one image that will be resized on mouseover. I know this won't work, but something like: onMouseOver= width="180" height="180" with the original swap image being: width="190" height="190" Thanks for the help and for not slamming me for my ignorance! Peace. Hi, I'm building a web site for someone. At the top of the page is the logo and some flowing lines going from left to right on screen. If you look he http://www.chrisvanochten.com/clients/voicecontrol/ and start resizing your browser window then you would see the content at the bottom moves along so that it is always in the center. The problem I have is that the image on the top will not do this. This is because it's a background image. I want the image to be positioned so that the logo is above the latest news section. I have tried using a normal image and aligning it to the center (scroll down on the page above for this) but the image is always anchored to the left of the screen if the image is larger than the browser window. Is there anyway to set the background image so that it is anchored in position and that it will run off both the left and right hand side of the screen (as opposed to just the right hand side)? Hi, I have a background image in my website and I want it to look the same in all window resolutions. However, when I resize the browser's window and I make it smaller althuogh I can see all the contents in the page I only can see a part of my background image. My CSS is like this: Code: body.secondary { background-image:url('images/flowers.JPG'); background-repeat:no-repeat; background-position:right top; background-attachment: fixed; } And if you need it this is the page. Many thanks! Cheers! How to set width & height of background image ? Since generally we set background image for anything like table, div tag etc. but i need that the image size is very shot while assigning as background image so how can i manage this width & height ? Please tell me that how can i do it bcoz I am not able to resize it by css also. OR Whenever I put any image in background then it must show me full image not a croped image whether cell size is low or very high...Generally it crops image or sometimes it repeats image 2 or more times. Since i know i can stop the repeating image but I want to know to put the fully image in cell / table / div etc.. Regards.... Hi - I am fairly new to coding but really enjoying it I am trying to create a background image effect as seen he http://www.prada.com/ and http://news.jam-factory.com/ - The background image fits to the window, without distorting the image, and bits are hidden when needed Here is my attempt: http://www.piersart.co.uk/random - but when the window is tall and thin, a black strip appears at the bottom. What am I doing wrong? I don't quite understand how to use overflow, if that is something I should be using. Do I have to use Javascript (to get window dimensions, or resize the image)? If so, how? Many thanks in advance is there any way that you can refresh one image on an html web page without haveing to refresh the whole page? Hi experts, would it be possible for any advice on a header issue please. I have created a website at www.ukdecals.com the website expands to fit most browsers and i've tried it in IE9 and Firefox, to me everything looks fine at my monitor settings of 1152 x 864 pxls But a friend has just sent me a screen shot from his screen on his computer in IE9 and the header seems to not be expanding in length across the page, would anyone one be able to view the source code and see if they could spy the problem, i've looked at it myself and i can't see it, but only learning html in the last couple of months, i'll admit that this ones got me stumped. I'd appreciate any help you could give. Kind Regards Jas.... Hello, I wrote the following HTML code: HTML Code: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <title>Admin Page</title> <link rel="stylesheet" type="text/css" href="css/style.css" /> </head> <body> <div id="main"> <h2>Admin Page</h2> <hr width="420" color="black" align="left"> <form method="post" action="$_SERVER[PHP_SELF]" name="form" > <div class="textbox" style="height:35px;"> Username: <input type="text" id="username" name="username" maxlength="30" /> </div> <div class="textbox"> Password: <span style="position: relative; left: 4px;"><input name="password" type="password" id="password" maxlength="30" /></span> </div> <br /> <div class="button"> <input type="submit" value="Sign In" name="submit"> </div> </form> <hr width="420" color="black" align="left" style="position: relative; top: -5px;"> <div id="info"> info here </div> </div> <!-- End main div --> </body> </html> and the following CSS code: HTML Code: body { background-color:gray; font-family:Comic Sans MS; font-size:12pt; color:black; } #info { font-family:sans-serif; font-weight:bold; position:relative; left:0px; width:420px; top:20px; } #main { position:relative; width:500px; left:420px; top:50px; } The problem I have is when you resize the browser nothing resizes. Can someone please help me get this page to resize? Help will be greatly appreciated. Thanks. I have read a bunch of stuff on this and checked the 14 pages, but I am getting confused. Will I be able to have my site open up full size according to the setting of the user computer by added a script to my site pages? TIA I am having a frustrating problem with IE7. I have a set of images that load in the proper place when the page loads in IE7. Then, if you resize the browser in any way the images do not move, but the rest of the page moves with the browser resize. This causes the images to go over other items on the page instead of staying where they should when the resize occurs. Does anyone have an idea about what the difference between Mozilla and and IE7 is that makes this type of problem occur? Anything I should look into or try to make the images "stick" to their proper place during a resize in IE7? Thanks. Hi all, I notice that on some websites when you minimize and maximize the window, the content on the site displays differently. For example if i reduce the browser window on this website - all content is still displayed as if it were open in a fully maximised window. What is this called? and How do you do it?? Cheers Raggy Hello, i need help understanding how to make my website automaticly resize depending on the resolution its viewed on i am viewing it on 1680 x 1050 and it looks fine but i then view it on a smaller monitor and everything gets moved about and squished, i notice on other websites that this is not the case and i do not know how its possible. my website url: http://mylocalmenu.co.uk/ you are able to view the source code and css files from the browser please help me with this problem, as it is the only problem i cannot fix. Thank you in advance to any help that i receive http://wantedfraternity.webs.com/oncall.html I cant resize the font of the "GOM" in the center. Its set at 13, but I need it around 18px. :-\ Help here plz. In order to load 200 jpg files quickly, I need a tool to resize these 200 jpg files to small size one time. (batch process) Can someone help me? Hello, How do I make a window.open method to open an html file and make it NOT resizable. Below is the code I have: onclick="window.open('img_1440.html', '','width=600px,height=550px resizable=0');" This window is going to be a small popup window and we want to make it not resizable. Thanks, Ruchir |