Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to build a Preview image by stacking transparent images based on Form selections using JavaScript?
    primarykey
    data
    text
    <p>Using HTML, CSS, and JavaScript I need to build a Form with Selection input fields and Radio selection fields. When each one of these fields is selected, I need to build a Preview image based on the selection they made. </p> <p>Each field will have an Image associated with it and then it will also have that same image replicated for each color.</p> <p>So if there was 20 Form fields that a user could pick it would have 20 images x 10 different color options and would result in there being 200 possible images to build there preview image!</p> <p>Here is an image that shows an example of what I am trying to accomplish...the Vans website uses this technique for a custom shoe generator with preview... <img src="https://i.stack.imgur.com/O61hQ.png" alt="http://i.stack.imgur.com/O61hQ.png"></p> <p>When you pick a section and then the color for that section, it loads a transparent image and stacks them together.</p> <p>For testing, I have made a set of transparent images for a demo form with only 4 Fields and 3 color choices so 12 images in total. (All shown below)</p> <p>When all the fields have been selected it should build an image preview to the user that is similar to this...<br> <img src="https://i.stack.imgur.com/vfqs9.png" alt="http://i.imgur.com/JYJdBnN.png"></p> <p>or the Alternative has a Top/Roof more like an octagon type shape</p> <p><img src="https://i.stack.imgur.com/TDjTA.png" alt="enter image description here"></p> <hr> <p><strong>bottom_blue</strong><br> <img src="https://i.stack.imgur.com/7P8Ua.png" alt="http://i.imgur.com/fsG49zS.png"> </p> <hr> <p><strong>bottom_green</strong><br> <img src="https://i.stack.imgur.com/h2Bpc.png" alt="http://i.imgur.com/TdjBCXk.png"> </p> <hr> <p><strong>bottom_red</strong><br> <img src="https://i.stack.imgur.com/jAX1y.png" alt="http://i.imgur.com/UxCyzij.png"> </p> <hr> <p><strong>entrance_blue</strong><br> <img src="https://i.stack.imgur.com/jehkB.png" alt="http://i.imgur.com/yLPtqYF.png"> </p> <hr> <p><strong>entrance_green</strong><br> <img src="https://i.stack.imgur.com/CgYnh.png" alt="http://i.imgur.com/YoxBjxL.png"> </p> <hr> <p><strong>entrance_red</strong><br> <img src="https://i.stack.imgur.com/lHbKP.png" alt="http://i.imgur.com/LQ07PgU.png"> </p> <hr> <p><strong>top_blue</strong><br> <img src="https://i.stack.imgur.com/wkRaA.png" alt="http://i.imgur.com/2ZmjBYe.png"> </p> <hr> <p><strong>top_green</strong><br> <img src="https://i.stack.imgur.com/lHk5X.png" alt="http://i.imgur.com/kImYjxF.png"> </p> <hr> <p><strong>top_red</strong><br> <img src="https://i.stack.imgur.com/LT6Nn.png" alt="http://i.imgur.com/wgtFL6h.png"> </p> <hr> <p><strong>top_red_octo</strong> <img src="https://i.stack.imgur.com/FjF7S.png" alt="enter image description here"></p> <hr> <p><strong>top_blue_octo</strong> <img src="https://i.stack.imgur.com/0FWGv.png" alt="enter image description here"></p> <hr> <p><strong>top_green_octo</strong> <img src="https://i.stack.imgur.com/92kyY.png" alt="enter image description here"></p> <hr> <p>Here is a basic form that could use the images...</p> <p><a href="http://jsfiddle.net/Pha4V/" rel="nofollow noreferrer">http://jsfiddle.net/Pha4V/</a></p> <pre><code>&lt;form id="form-ChannelType"&gt; &lt;p&gt; Select a bottom (just 1 in the demo)&lt;br&gt; &lt;select name="bottom" class="form-control" id="bottom" size="1"&gt; &lt;option value="bottom1"&gt;Bottom 1&lt;/option&gt; &lt;/select&gt; &lt;/p&gt; &lt;p&gt; Select a Front (just 1 in the demo)&lt;br&gt; &lt;select name="front" class="form-control" id="front-1" size="1"&gt; &lt;option value="front1"&gt;Front 1&lt;/option&gt; &lt;/select&gt; &lt;/p&gt; &lt;p&gt; Select a Top&lt;br&gt; &lt;select name="bottom" class="form-control" id="bottom" size="2"&gt; &lt;option value="bottom_triangle"&gt;Triangle Shaped Top&lt;/option&gt; &lt;option value="bottom_octo"&gt;Octo. Shaped Top&lt;/option&gt; &lt;/select&gt; &lt;/p&gt; &lt;p&gt; Select a Color&lt;br&gt; &lt;select name="color" class="form-control" id="color" size="3"&gt; &lt;option value="blue"&gt;Blue&lt;/option&gt; &lt;option value="green"&gt;Green&lt;/option&gt; &lt;option value="red"&gt;Red&lt;/option&gt; &lt;/select&gt; &lt;/p&gt; &lt;/form&gt; </code></pre> <hr> <p>Can anyone help me in the logic of how to make such a form work? I need to make it work in a way that can easily scale to hundreds of options and images.</p> <p>With the basic form above, it would need to build a preview image by stacking appropriate images based on the form selections. I don't expect anyone to do all the work for this unless they are simply up for the challenge but I would appreciate any help or ideas on how to best make this work?</p> <hr> <p><strong>NOTE:</strong> My final project that will be based off of this will be much different. It will be used for a custom sign generator. I cannot use ImageMagick or GD libraries to do on the fly images, so each image has to be built and each layer changed. Instead of abuilding a simple house structure I will have options such as...</p> <ul> <li><strong>Sign Type</strong> which will determine a lot of the setting that are shown or hidden after it based on the type of sign selected.</li> <li><strong>Font</strong> the base image will have one for each font and in each font will be in each color as well. So 10 fonts x 15 colors = could easily be over 150 possible images to show just as the BASE image</li> <li><strong>Colors</strong> There will be from 2-4 different color options that will change the color for different parts of the sign. So all the image combinations listed above x the different color areas = lots of images</li> </ul> <p>So you can see this will be a pretty big beast when it's all done and I could use any help in getting a good start on it. I don't think a HUGE if/else or switch statement is the best way to go with something like this that can have hundreds of image combinations but I could be wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload