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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting IMG height/width to super-impose another IMG 1

Status
Not open for further replies.

cruise95

Programmer
Oct 7, 2003
56
US
1) First I am uploading an image.
2) If the image looks ok then it is displayed as is else the image is displayed but with an image of an 'X' (with a transparent background) over it. Of course the 'X' should be able to change in size to fit any size picture (if the 'X' is static then it may be too small or too big)

I need to get the height and width of the image so I can specify how big the 'X' should be.

when using javascript alone, then I can get the height/width of the first image. However, when I combine the code with CF, then it doesn't work correctly.

I'm also not sure how to place the 'X' over the uploaded image.

Any help would be great! Thanx
 
you will need som sort of object or dll on the server that has the capability of taking an image and basicly editing it to your specs. image.dll is one that I use for creating thumbnails, and i know it does a lot more than just that, It might be able to merge two images, but not sure.

 
Thanx for your suggestion about the dll
I finaly found a solution using JavaScript. It'm not so sure that it's the most elegant solution...but it seems to work great.

Here's a real simple test code that I used to get this working at first (I threw in some extra "blah"s so the page had something else on it besides just the images):

<html>
<head>
<script language=&quot;JavaScript&quot;>
<!--
function setImgAttributes() {
var width;
var height;

if (document.images) {
// get the first images height/width
width = document.images['myBabe'].width;
height = document.images['myBabe'].height;

// set the second iamges height/width
// the same as the first image's
document.images[1].width = width;
document.images[1].height = height;
}
}
//-->
</script>
</head>

<body onload=&quot;setImgAttributes();&quot;>
blah<BR>
blah<BR>

blah
<IMG src=&quot;babe.jpg&quot; name=myBabe style=&quot;position:absolute&quot;>
<IMG src=&quot;x.gif&quot; name=myX id=myX style=&quot;position:relative&quot;>
</body>
</html>


Thanx again for your help
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top