Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Resizing of images

Status
Not open for further replies.

tiramisu01

Programmer
Feb 11, 2000
19
SG
<br>
Is there a better way of of resizing images dynamically besides <br>
<br>
imagename.height *= 0.5;<br>
imagenname.width *= 0.5;<br>
<br>
on onLoad?<br>

 
What do you need it for? If you want to do a square image, you could do this:<i><br>
function(x)<br>
{<br>
imagename.height *= x;<br>
imagenname.width *= x;<br>
}<br>
</i><br>
I need more information to help you. <p>REH<br><a href=mailto:hawkdogg@crosswinds.net>hawkdogg@crosswinds.net</a><br><a href= by Linux</a><br>Learn Linux and Leave out the Windows :)
 
What do you need it for? If you want to do a square image, you could do this:<i><br>
function(x)<br>
{<br>
imagename.height *= x;<br>
imagenname.width *= x;<br>
}<br>
</i><br>
I need more information to help you. <p>REH<br><a href=mailto:hawkdogg@crosswinds.net>hawkdogg@crosswinds.net</a><br><a href= by Linux</a><br>Learn Linux and Leave out the Windows :)
 
Have you considered downsizing the image itself with an image editor like photoshop and creating it as a thumbnail, making it either click to a larger image or you can get an image cruncher and compress the image without losing to much size or quality, there is also the resolution to consider. the higher the resolution the bigger the file is.
 
How about just changing the width and height attriubtes of the img tag?<br>
<br>
like this:<br>
<br>
&lt;img src=... width=250 height=345&gt;<br>
<br>
make sense? <p>theEclipse<br><a href=mailto: > </a><br><a href=robacarp.webjump.com>robacarp.webjump.com</a><br>
 
Oh okie. Sorry about that. Hee.<br>
I need to dynamically resize images, or more accurate to make them smaller. I don't wanna distort the pic from the actual pic, so I don't wanna hardcode their width and height. I found that multiplying itself with a 0.something works real fine. Just wanna explore more alternatives or maybe better ways. 8)
 
Huh, I must have hit submit twice.<br>
Anyway, if you want dynamically resizable images, that would require the usage of layers (in Nestcape) or iframes (M$IE).<br>
This is what I would do: put the image in a layer with the dimensions defined in JavaScript or css, link it to a JavaScript function (&lt;a href=&quot;javascript:blah()&quot;), and when the person clicks on the link, the JavaScript function would resize the image to the size of the original image. <p>REH<br><a href=mailto:hawkdogg@crosswinds.net>hawkdogg@crosswinds.net</a><br><a href= by Linux</a><br>Learn Linux and Leave out the Windows :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top