Click here to Skip to main content
15,895,256 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We have a requirement for a website similar to lenskart.com in which the user can upload their image or take a picture using their webcam. There are a no. of sunglasses that they can choose from and clicking on it should make the glass appear on their face. So, my question is how can I place one image over another image, in this case, the image of the sunglass over the user's picture. I have already tried dragging a smaller image onto a larger image and extracting the x and y co-ordinate positions of the smaller image over the larger one. Now, I want to be able to place the sunglass image over the user picture based on these x and y co-ordinate positions. Can anyone guide me as to how to achieve this?
Posted
Comments
lukeer 21-Aug-13 4:12am    
Where is the problem in "simply doing it"?

What behaviour do you expect? What behaviour do you see?

Or:
What error message appears? What part of your code does it appear in?

Make Transparent PNG files as sun glasses,
and use it as background image for a DIV (or Panel).
Then use Javascript, or JQuery to move the picture,,,

Check this..

http://stackoverflow.com/questions/6508139/how-to-move-an-image-to-the-mouse-position-in-html-javascript[^]
 
Share this answer
 
Hello Deepa,

You can use CSS rules to achieve this. Basically you need a div containing an img element. The img element will display the goggle and the div will have the background image of the face. See the demo[^] on JSFiddle.

Regards,
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900