| re: Send image to applet
Jordan Gomila wrote:
[color=blue]
> Thanks, but I am not trying to change width and
> heigth. I am changing pixel color.
> I have done it with a java applet but I wish to
> allow to load images from web, and as it is not
> allowed with untrusted applets I amb looking for
> other alternatives.[/color]
Client side javascript actually can't *change* image properties. It can
only affect the way they are shown on the user's screen, which is a
significant difference.
It's not very clear to me what you mean by "changing pixel color".
There are some CSS/javascript possibilities that you could use/combine
to alter the image's appearance.
Maybe this could be a start:
<html>
<head>
<style>
div { width:200px;height:200px;background-color: white; }
</style>
<script language="javascript">
function alterpic(o,c)
{
if (document.images) {
document.getElementById("back").style.backgroundCo lor=c;
document.images["sImg"].style.filter = "alpha(opacity="+o+")";
document.images["sImg"].style.MozOpacity=o/100;
}
}
</script>
</head>
<body bgcolor="white">
<p>
<div id="back" name="back"><img name="sImg"
src="http://groups.google.be/img/watched_y.gif"
width="200" height="200"></div>
</p>
<p>
<input type="button"
onClick="alterpic('30','red')" value="Version 1">
<input type="button"
onClick="alterpic('80','blue')" value="Version 2">
<input type="button"
onClick="alterpic('40','green')" value="Version 3">
<input type="button"
onClick="alterpic('100','white')" value="Original">
</p>
</body>
</html>
Please note that you're on sensitive grounds here when it comes to
browser compatibility. I tested the code on latest IE and NS versions -
should be no problem there.
If you want to actually change your image, you should use a server side
approach. E.g. PHP/CGI with a call to GD/ImageMagick on Unix based
operating systems.
--
Bart |