19 package org.turro.zkoss.image;
21 import org.turro.auth.Authentication;
22 import org.turro.elephant.TemplateControl;
23 import org.turro.elephant.context.Application;
24 import org.turro.plugin.contacts.IContact;
25 import org.zkoss.zk.ui.event.UploadEvent;
26 import org.zkoss.zk.ui.select.annotation.Listen;
27 import org.zkoss.zk.ui.select.annotation.Wire;
28 import org.zkoss.zul.Button;
36 private String folder, fileName;
37 private int maxHeight, minHeight, maxWidth, minWidth;
39 @Wire(
"#image")
private Button image;
42 @Listen(
"onUpload=#image")
51 @Listen(
"onCrop=#cropper")
52 public
void onCrop(UploadEvent event) {
75 this.fileName = fileName;
79 this.maxHeight = maxHeight;
83 this.minHeight = minHeight;
87 this.maxWidth = maxWidth;
91 this.minWidth = minWidth;
104 private void initComponents() {
106 if(contact !=
null && contact.
isWebUser()) {
112 Application.getApplication().sendRedirect(
"/user");
116 private String getImagePath() {
117 return folder +
"/" + fileName;
static IContact getIContact()
void setFixedWidth(int fixedWidth)
void setFileName(String fileName)
void onCrop(UploadEvent event)
void setFolder(String folder)
void setMaxHeight(int maxHeight)
void setMinHeight(int minHeight)
void onUpload(UploadEvent event)
void setMaxWidth(int maxWidth)
void setFixedHeight(int fixedHeight)
void setMinWidth(int minWidth)