[OT] Dynamic web content

Andrew Galdes AGaldes at elders.com.au
Fri May 9 10:21:37 CST 2003


Ben,

Your a bloody champ! Thanks. Infact, i think i will do a combination of both server-side and js. Thanks heaps all. :)

Andrew.

> -----Original Message-----
> From: Ben Williams [mailto:benw at webmedia.com.au]
> Sent: Friday, 9 May 2003 10:24 AM
> To: Andrew Galdes
> Cc: Linux Group (E-mail)
> Subject: Re: [OT] Dynamic web content
> 
> 
> On 9/05/2003 9:27 AM, Andrew Galdes wrote:
> 
> > Hello all,
> > 
> > This may be a simple one for the vb, js, asp, dhtml, perl 
> etc people. I would like to be able to dynamically change the 
> size if an image by entering a new value into an input box 
> and hitting the "Calculate" button. 
> > 
> > What is the best way to do this? Any ideas?
> > 
> > Cheers,
> > AG.
> > 
> 
> given that quality is not a huge issue, and you don't want to 
> necessarily do it server-side and deliver a whole resized 
> image back to 
> the browser, javascript is definitely the way to go. and you 
> can in fact 
> make cross-browser javascript.
> 
> in the img tag, make sure it has an ID attribute:
> 
> <img src="mypicture.jpg" id="mypic"/>
> 
> then some javascript:
> 
> <script type="text/javascript">
> 
> function resizeimg(frm) {
> 	mypic = document.getElementById("mypic");
> 	mypic.width = frm.width.value;
> 	mypic.height = frm.height.value;
> 	/* stops the form from actually submitting - a reload isn't
> 		necessary */
> 	return false;
> }
> 
> </script>
> 
> and then your form:
> 
> <form name="resizer" method="post" action="" onsubmit="return 
> resizeimg(this)">
> new width: <input type="text" name="width"><br>
> new height: <input type="text" name="height"><br>
> <input type="submit" value="Resize image!">
> </form>
> 
> this is untested, but i'm pretty sure it should work.
> 
>   - Ben
> --
> There are 10 types of people in the world: Those who 
> understand binary, 
> and those who don't.
> 
> 

-- 
LinuxSA WWW: http://www.linuxsa.org.au/ IRC: #linuxsa on irc.freenode.net
To unsubscribe from the LinuxSA list:
  mail linuxsa-request at linuxsa.org.au with "unsubscribe" as the subject



More information about the linuxsa mailing list