<?xml version="1.0" encoding="utf-8" ?><rss version="2.0" xml:base="https://www.webmaster-forums.net/crss/node/1031768" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title></title>
    <link>https://www.webmaster-forums.net/crss/node/1031768</link>
    <description></description>
    <language>en</language>
          <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/forcing-images-stay-within-certain-boundaries#comment-1187465</link>
    <description> &lt;p&gt;It will be better you do it on server side using php or whatever scripting language yr application is in.&lt;/p&gt;
 </description>
     <pubDate>Thu, 08 Dec 2005 09:47:56 +0000</pubDate>
 <dc:creator>john551</dc:creator>
 <guid isPermaLink="false">comment 1187465 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/forcing-images-stay-within-certain-boundaries#comment-1186419</link>
    <description> &lt;p&gt;I found a way, quite easy actually, and wanted to share it with you:&lt;/p&gt;
&lt;p&gt;&lt;div class=&quot;codeblock&quot;&gt;&lt;code&gt;&amp;lt;html&amp;gt;&amp;lt;body topmargin=&amp;quot;0&amp;quot; leftmargin=&amp;quot;0&amp;quot; rightmargin=&amp;quot;0&amp;quot; bottommargin=&amp;quot;0&amp;quot; style=&amp;quot;margin:0px;&amp;quot; style=&amp;quot;background:none;&amp;quot;&amp;gt;&lt;br /&gt;&amp;lt;?php&lt;br /&gt;echo &amp;lt;&amp;lt;&amp;lt;EndOfHTML&lt;br /&gt;&amp;lt;a href=&amp;quot;$pic&amp;quot; target=&amp;quot;new&amp;quot;&amp;gt;&amp;lt;img id=&amp;quot;pic&amp;quot; src=&amp;quot;$pic&amp;quot; onLoad=&amp;quot;resize(this);&amp;quot; border=&amp;quot;0&amp;quot;&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;amp;gt;&amp;lt;!--&lt;br /&gt;&lt;br /&gt;PicValid = 0;&lt;br /&gt;&lt;br /&gt;function resize(PIC) {&lt;br /&gt;&lt;br /&gt; PicValid = 1;&lt;br /&gt; tooBig = 0;&lt;br /&gt;&lt;br /&gt; height = PIC.height;&lt;br /&gt; width = PIC.width;&lt;br /&gt;&lt;br /&gt; if(width &amp;gt; 266) { &lt;br /&gt; 	width = 266;&lt;br /&gt;	tooBig = 1;&lt;br /&gt;	PIC.width = 266;&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; parent.document.getElementById(window.name).setAttribute(&amp;quot;width&amp;quot;,PIC.width);&lt;br /&gt;&lt;br /&gt; if(window.opera) { &lt;br /&gt;	 parent.document.getElementById(window.name).setAttribute(&amp;quot;height&amp;quot;,PIC.height);&lt;br /&gt; } else {&lt;br /&gt;	parent.document.getElementById(window.name).setAttribute(&amp;quot;height&amp;quot;,PIC.height+3);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; if(linkStr = parent.document.getElementById(window.name).parentNode.getAttribute(&amp;quot;href&amp;quot;))	{&lt;br /&gt;&lt;br /&gt;	document.getElementsByTagName(&amp;quot;a&amp;quot;)[0].href = linkStr;&lt;br /&gt;&lt;br /&gt; } else if(tooBig) {&lt;br /&gt;&lt;br /&gt;	myDiv = document.createElement(&amp;quot;div&amp;quot;);&lt;br /&gt;	myDiv.style.position = &amp;quot;absolute&amp;quot;;&lt;br /&gt;	myDiv.style.top = PIC.height-16 + &amp;quot;px&amp;quot;;&lt;br /&gt;	myDiv.style.left = PIC.width-16 + &amp;quot;px&amp;quot;;&lt;br /&gt;&lt;br /&gt;	myDivLink = myDiv.appendChild(document.createElement(&amp;quot;a&amp;quot;));&lt;br /&gt;	myDivLink.setAttribute(&amp;quot;href&amp;quot;,PIC.src);&lt;br /&gt;	myDivLink.setAttribute(&amp;quot;target&amp;quot;,&amp;quot;new&amp;quot;);&lt;br /&gt;&lt;br /&gt;	myDivImage = myDivLink.appendChild(document.createElement(&amp;quot;img&amp;quot;));&lt;br /&gt;	myDivImage.setAttribute(&amp;quot;border&amp;quot;,0);&lt;br /&gt;	myDivImage.setAttribute(&amp;quot;src&amp;quot;,&amp;quot;img/expand.gif&amp;quot;);&lt;br /&gt;	&lt;br /&gt;	myDivObj = document.firstChild.childNodes[1].appendChild(myDiv);	&lt;br /&gt;&lt;br /&gt;	PIC.parentNode.removeAttribute(&amp;quot;href&amp;quot;);&lt;br /&gt;&lt;br /&gt; } else {&lt;br /&gt;	PIC.parentNode.removeAttribute(&amp;quot;href&amp;quot;);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function noPic() {&lt;br /&gt; if(!PicValid) {&lt;br /&gt; 	document.getElementsByTagName(&amp;quot;img&amp;quot;)[0].src = &amp;quot;#&amp;quot;;&lt;br /&gt;	parent.document.getElementById(window.name).setAttribute(&amp;quot;height&amp;quot;,30);&lt;br /&gt;	parent.document.getElementById(window.name).setAttribute(&amp;quot;width&amp;quot;,30);&lt;br /&gt; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;window.setTimeout(&amp;quot;noPic()&amp;quot;,30000);&lt;br /&gt;&lt;br /&gt;// --&amp;gt;&amp;amp;lt;/script&amp;amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;EndOfHTML;&lt;/code&gt;&lt;/div&gt;&#039;&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://www.webmaster-forums.net/misc/smileys/smile.png&quot; title=&quot;Smiling&quot; alt=&quot;Smiling&quot; class=&quot;smiley-content&quot; /&gt;&lt;/p&gt;
 </description>
     <pubDate>Thu, 24 Nov 2005 20:49:29 +0000</pubDate>
 <dc:creator>Patrick A Baer</dc:creator>
 <guid isPermaLink="false">comment 1186419 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/forcing-images-stay-within-certain-boundaries#comment-1186301</link>
    <description> &lt;p&gt;Well, what you could try and do is set a div that is 200px by 200px and set the image as the background, centred.&lt;/p&gt;
&lt;p&gt;If the image doesn&#039;t show up right, within the boundaries, then, the user will upload another image for his profile?&lt;/p&gt;
 </description>
     <pubDate>Wed, 23 Nov 2005 07:57:54 +0000</pubDate>
 <dc:creator>Renegade</dc:creator>
 <guid isPermaLink="false">comment 1186301 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/forcing-images-stay-within-certain-boundaries#comment-1186288</link>
    <description> &lt;blockquote class=&quot;bb-quote-body&quot;&gt;&lt;p&gt;&lt;strong&gt;matt_w wrote:&lt;/strong&gt; Patrick,&lt;/p&gt;
&lt;p&gt;The best thing to do is to programmatically resize the image... but if you don&#039;t want to do that, you can set the size attribute for the width only. IE and Firefox/Mozilla will adjust the height to maintain the aspect ratio and scale the image to match the specified width. (I haven&#039;t tested this in other browsers.) The drawback is that smaller images will be made larger, which can look pretty ugly.&lt;/p&gt;
&lt;p&gt;Matt&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;I agree with matt_w. you can do this an alternative solution, but as he said it will cause the picture look ugly.&lt;/p&gt;
 </description>
     <pubDate>Wed, 23 Nov 2005 05:39:00 +0000</pubDate>
 <dc:creator>edpudol</dc:creator>
 <guid isPermaLink="false">comment 1186288 at https://www.webmaster-forums.net</guid>
  </item>
  <item>
    <title></title>
    <link>https://www.webmaster-forums.net/html-css-and-javascript/forcing-images-stay-within-certain-boundaries#comment-1186163</link>
    <description> &lt;p&gt;Patrick,&lt;/p&gt;
&lt;p&gt;The best thing to do is to programmatically resize the image... but if you don&#039;t want to do that, you can set the size attribute for the width only. IE and Firefox/Mozilla will adjust the height to maintain the aspect ratio and scale the image to match the specified width. (I haven&#039;t tested this in other browsers.) The drawback is that smaller images will be made larger, which can look pretty ugly.&lt;/p&gt;
&lt;p&gt;Matt&lt;/p&gt;
 </description>
     <pubDate>Tue, 22 Nov 2005 03:16:41 +0000</pubDate>
 <dc:creator>matt_w</dc:creator>
 <guid isPermaLink="false">comment 1186163 at https://www.webmaster-forums.net</guid>
  </item>
  </channel>
</rss>
