How to ›
LWIE is very simple to initialize, just include the lightwie.js file this way:
<script src="lightwie.js" type="text/javascript">
Then, create a new ImageEditor instance giving it parameters:
<script>var T = new ImageEditor("imageid", OperatingMode, "left blank for now", "layer class", opacity);</script>
- imageid: id of the image you want to edit
- OperatingMode: 0 (single area mode = user can't select multiple areas at once) or 1 (multiple area mode = user can select multiple areas at once)
- layer class: css class to apply to area's layer (you can set IEDefault)
- opacity: opacity of area's layer (you can set it as a multiple of 10 -IE style: 40- or as a number between 0 and 1 -FF style: 0.4-), the editor automatically convert it
A function is automatically called when an area is drawn, you can use this function to act when it is done. Simply define function T.areaEvent (or any ImageEditor's instance), like this:
T.areaEvent = function (image, x, y, width, height) {
// image: object image
// x: x position of area
// y: y position of area
// width/height: size of area
};
Attention ›
- Don't forget to include Prototype.js file!
- Images must has css position's property set to "absolute" or "relative"