js插件---画图软件wePaint如何使用(插入背景图片,保存图片,上传图片)
1 <!DOCTYPE html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <title>Websanova Paint</title>
6
7 <!-- jQuery -->
8 <script type="text/javascript" src="./inc/jquery.1.8."></script>
9 <script type="text/javascript" src="./inc/"></script>
10 <script type="text/javascript" src="./inc/"></script>
11 <script type="text/javascript" src="./inc/"></script>
12 <script type="text/javascript" src="./inc/"></script>
13
14 <!-- wColorPicker -->
15 <link rel="Stylesheet" type="text/css" href="./inc/" />
16 <script type="text/javascript" src="./inc/"></script>
17
18 <!-- wPaint -->
19 <link rel="Stylesheet" type="text/css" href="./" />
20 <script type="text/javascript" src="./"></script>
21
22 </head>
23 <body>
24
25 <h2>Default</h2>
26
27 <table><tr>
28 <td>
29 <div id="wPaint" style="position:relative; width:500px; height:300px; background:#CACACA; border:solid black 1px;"></div>
30 </td><td>
31 <img id="canvasImage" src=""/>
32 </td>
33 </tr><tr>
34 <td colspan="2">
35 <div>
36 <a href="javascript:loadImage_base64();">load image (base64 encoded)</a> |
37 <a href="javascript:loadImage_png();">load image (png)</a> |
38 <a href="javascript:loadImage_jpg();">load image (jpg)</a> |
39 <a href="javascript:saveImage();">save image</a> |
40 <a href="javascript:clearCanvas();">clear canvas</a>
41 <input type="button" value="Upload Image" onclick="upload_image('wPaint');"/>
42 </div><br/>
43
44 image data: <input id="canvasImageData" type="text" />
45 down: <input id="canvasDown" type="text" />
46 move: <input id="canvasMove" type="text" />
47 up: <input id="canvasUp" type="text" />
48 </td>
49 </tr></table>
50
51 <script type="text/javascript">
52 var wp = $("#wPaint").wPaint({
53 image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAGQCAYAAABYs5LGAAASMklEQVR4nO3dTaiux10A8BGlcVEbFzFNbclX24WRmCYttSEm5JrEjQi6qAuhUJQsSjZ12V2v6M5QFxVcdCdIwE3R0BgUAsa2CFIwi9JW0ZuQr5KkjWmT5ubenL+Lew49Pfd9z3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TkS6oXUbYSQF5+OiR9UkdBhYRLq9wGJyEJG+1rotMKpo/BW4Y3Esqd/Nr9CDuPIqyuxvNUekG1vHDrtgBxJ6l++ZAIBVxYKvv5U6Ql5Qd9fvmQCAVbU8Oj+s/40ZdV8uUTcA7JQZl76KvrM9s+5nStYNADsl5/R7pfo3PY/+Zo26AGCnTUzot7aOEwA4wymn330aFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACA+v4fELYJD7aYfCIAAAAASUVORK5CYII=",
54 drawDown: function(e, mode){ $("#canvasDown").val(this. + ": " + + ',' + ); },
55 drawMove: function(e, mode){ $("#canvasMove").val(this. + ": " + + ',' + ); },
56 drawUp: function(e, mode){ $("#canvasUp").val(this. + ": " + + ',' + ); }
57 }).data('_wPaint');
58
59 function loadImage_base64()
60 {
61 $("#wPaint").wPaint("image", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAGQCAYAAABYs5LGAAAQdklEQVR4nO3dTcg211kA4KO72LRgi9JWpcuEatDEoFBaiVp/NhJKMdvSrMQuonWVXVQsAUGoblyIYCii7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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADAm/0frx+55AOewsEAAAAASUVORK5CYII=");
62 }
63
64 function loadImage_png()
65 {
66 $("#wPaint").wPaint("image", "images/demo/");
67 }
68
69 function loadImage_jpg()
70 {
71 $("#wPaint").wPaint("image", "images/demo/");
72 }
73
74 function saveImage()
75 {
76 var imageData = $("#wPaint").wPaint("image");
77
78 $("#canvasImage").attr('src', imageData);
79 $("#canvasImageData").val(imageData);
80 }
81
82 function clearCanvas()
83 {
84 $("#wPaint").wPaint("clear");
85 }
86
87 function upload_image(id)
88 {
89 var imageData = $("#" + id).wPaint("image");
90
91 $.ajax({
92 url: '/wPaint/',
93 data: {image: imageData},
94 type: 'post',
95 success: function(resp)
96 {
97 alert('successfully uploaded image!');
98 }
99 });
100 }
101 </script>
102
103
104 <h2>Load Image With Background</h2>
105 The background cannot be modified, but will be part of the save (try the eraser):
106
107 <table><tr>
108 <td>
109 <div id="wPaint2" style="position:relative; width:500px; height:300px; background:#CACACA; border:solid black 1px;"></div>
110 </td><td>
111 <img id="canvasImage2" src=""/>
112 </td>
113 </tr><tr>
114 <td colspan="2">
115 <div>
116 <a href="javascript:saveImage2();">save image</a> |
117 <a href="javascript:updateBg2();">update bg</a>
118 <input type="button" value="Upload Image" onclick="upload_image('wPaint2');"/>
119 </div><br/>
120 </td>
121 </tr></table>
122
123 <br/><br/>
124
125 <script type="text/javascript">
126 $("#wPaint2").wPaint({
127 menuOrientation: 'vertical',
128 image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAfQAAAGQCAYAAABYs5LGAAASMklEQVR4nO3dTaiux10A8BGlcVEbFzFNbclX24WRmCYttSEm5JrEjQi6qAuhUJQsSjZ12V2v6M5QFxVcdCdIwE3R0BgUAsa2CFIwi9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Swqbzeuq0wisJz75VWcZTsE2CCiHRnxcT+TkS6oXUbYSQF5+OiR9UkdBhYRLq9wGJyEJG+1rotMKpo/BW4Y3Esqd/Nr9CDuPIqyuxvNUekG1vHDrtgBxJ6l++ZAIBVxYKvv5U6Ql5Qd9fvmQCAVbU8Oj+s/40ZdV8uUTcA7JQZl76KvrM9s+5nStYNADsl5/R7pfo3PY/+Zo26AGCnTUzot7aOEwA4wymn330aFQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACA+v4fELYJD7aYfCIAAAAASUVORK5CYII=",
129 imageBg: 'images/demo/'
130 });
131
132 function saveImage2()
133 {
134 var imageData2 = $("#wPaint2").wPaint("image");
135
136 $("#canvasImage2").attr('src', imageData2);
137 }
138
139 function updateBg2()
140 {
141 $("#wPaint2").wPaint("imageBg", 'images/demo/');
142 }
143
144 </script>
145 </body>
146 </html>