0

I am working on an application that allows a user to select multiple images kind of like an avatar creator. The class .hidden hides all of the unused images and I use javascript to allow the user to swap them out. I am trying to implement a save function so that the user can save their work.

    <img name="blondeHair" src="blonde-hair.png">
    <img name="darkHair" src="dark-hair.png" class="hidden">
    <img name="tan-skin" src="tan-skin.png">
    <img name="light-skin" src="light-skin.png" class="hidden">
 <a href="save.php">

I have tried to use a pdf library such as pdfCreator but cant seem to make it work because the libraries do not seem to accept the img tag or the class names. Any help is appreciated. Thank you.

codeKracken
  • 127
  • 14
  • What exactly do you need? Do you need them saved to a PDF, to the filesystem or to a database? – Munsterlander Apr 30 '16 at 05:32
  • I would like for the user to be able to save to their device either pdf or jpg etc... – codeKracken Apr 30 '16 at 05:34
  • Ok, then there are multiple SOF responses for this type of problem, such as: http://stackoverflow.com/questions/7951326/save-image-to-users-disk-using-javascript – Munsterlander Apr 30 '16 at 05:36
  • @codeKracken So these Images are layer; the User has to select some, and you want a possibility to merge these and save the result? You're talking about an Avatar, how do you want to use these created Images? – Thomas Apr 30 '16 at 05:42
  • I appreciate the responses but the problem is that the images are created dynamically by the user there is no way for me to know what they might select ahead of time. – codeKracken Apr 30 '16 at 05:43
  • Yes @Thomas you are correct, The images are layered they will need to be merged. There are 6 total avatars that they will be creating all with different hair, skin tones, clothes etc.. – codeKracken Apr 30 '16 at 05:46
  • But you provide the layers, the images, don't you? So you can compute every possible combination. 2nd. If this would produce to many images, you can render the container with the layer into a `canvas` and get the [data URI](//developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL) and use it. If the user really really needs to download the result, he can save the (merged) result of the canvas. – Thomas Apr 30 '16 at 07:19

0 Answers0