Image problems

Ask about general coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 32
Joined: Tue Jan 28, 2003 10:19 am
Location: Québec

Fri Feb 07, 2003 11:20 am

Here's what i need to do: I have an accident report form. On it, i have a Image button of a human body. When the user clicks the body, it records the coords of the click... this i can do.. but i now need to place a crosshair gif a those coords but i hva ne idea how...

can anyone help out ?

User avatar
Joan Garnet
Posts: 387
Joined: Sat Aug 03, 2002 2:56 am
Location: Mars

Fri Feb 07, 2003 4:34 pm

I think it can be achieved by using javascript and layers...

New php-forum User
New php-forum User
Posts: 191
Joined: Wed Jan 29, 2003 7:11 am
Location: UK

Sat Feb 08, 2003 2:23 am

<div><img src="body.jpg" width="100" height="200" />
<div style="position:relative; top:-150; left:50;">+</div>

the nested div will be relative to the lower left corner of the containing div (assuming these divs are not within another div)

the top:-150 would place the topleft of the + at 150px upwards from the base

so, it would be something like

$cd = $crosshair-dimension; // width-n-height of +
echo '<div style="position:relative; top:-'. ($imgheight-$ycoord-$cd). 'px; left:'. ($xcoord-$cd). 'px;"><img src="crosshair.jpg" width="'.$cd.'" height="'.$cd.'" /></div';

sort of thing

Post Reply