Client Side Things
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesClient Side Things

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
  #1  
Old September 27th, 2009, 02:03 PM
joedel263 joedel263 is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 5 joedel263 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 46 m 30 sec
Reputation Power: 0
Layering multiple images

Hi,

In my spare time I've been writing a game in php. For character creation I've currently got a form running where the user can select (via dropdown) the different features (color, eyes, outfit, backround, etc..) which then pulls the individual images, merges them, and saves back to the server so it doesn't need to be dynamically created all the time.

I'd like to be able to display the images on the form as the user is selecting them. I'm just not sure where to start.. (images are all transparent pngs and, for example, if the user selects one of everything then changes their skin color selection, it would need to change the 'body' image and not just load on top of everything else)

If someone could just point me in a direction I'd appreciate it. I'm at a loss as to where to even begin..

Thanks

Joe

Reply With Quote
  #2  
Old September 27th, 2009, 04:39 PM
IAmALlama IAmALlama is offline
Me
Click here for more information. Click here for more information
Click here for more information
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 1,937 IAmALlama User rank is Private First Class (20 - 50 Reputation Level)IAmALlama User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Week 5 Days 1 h 54 m 18 sec
Reputation Power: 4
I would think you could just place the images right next to one another and use like a negative margin to "stack" them. this of course works best when all images are the same size. I did a little test of this by making 4 images, each 200px by 200px and just put them next to each other and all but the first have a margin-left of -200px. it worked fine. I made a little select box and a javascript image changer that changes an image based on the select box. replace the images with your images and this should work.
Code:
<html>
<head>
<style type="text/css">
img { height: 200px; width: 200px; }
</style>
<script type="text/javascript">
function changeIt(sel, eID){
    img = document.getElementById(eID);
    img.src = sel.value+'.png';
}
</script>
</head>
<body>
Image 1: <select onChange="changeIt(this, 'image1');">
<option value='T'>T</option>
<option value='E'>E</option>
<option value='S'>S</option>
<option value='T2'>T</option>
</select>
Image 2: <select onChange="changeIt(this, 'image2');">
<option value='T'>T</option>
<option value='E'>E</option>
<option value='S'>S</option>
<option value='T2'>T</option>
</select>
Image 3: <select onChange="changeIt(this, 'image3');">
<option value='T'>T</option>
<option value='E'>E</option>
<option value='S'>S</option>
<option value='T2'>T</option>
</select><br />
<img src='T.png' id='image1'><img src='T.png' style='margin-left: -200px;' id='image2'><img src='T.png' style='margin-left: -200px;' id='image3'>
</body>
</html>

also, each image should be on the same line or else they won't line up all the way from the new lines adding a space between the images. you can also set the z-index of each image so that they layer correctly. so for example if you know the body goes in back always then you can set that lower than the eyes which should be on top.

Reply With Quote
  #3  
Old September 30th, 2009, 08:33 PM
joedel263 joedel263 is offline
Registered User
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Nov 2007
Posts: 5 joedel263 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 46 m 30 sec
Reputation Power: 0
Thank you!

I only know the basics of Javascript and CSS (I know.. a travesty, but everything is self taught..) so I probably would've still been sitting here trying to figure it out otherwise.

I really appreciate the code samples and suggestions.

Joe

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesClient Side Things > Layering multiple images


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 6 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek