Warning: session_start(): open(/var/lib/php/sessions/sess_u0f2bces24p5gjbrk3p3mkergh, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass ImageChooser extends SingleComponentPanel {
new ImageSurface is;
new JTextField tfPath;
*(BufferedImage img) {
this();
setImage(img);
}
ifclass PNGFile
*(PNGFile png) { this(png == null ? null : png.getImage()); }
endif
*() {
bindToComponent(this, r { is.zoomToWindow() });
is.loadFromClipboard();
//setComponent(withLabel("Path to image or snippet ID:", tfPath));
setComponent(jMinSize(100, 100, jscroll(is)));
componentPopupMenu(is, voidfunc(JPopupMenu menu) {
addMenuItem(menu, "Screenshot in 3", r {
thread "Screenshot in 3" {
sleep(3000);
final BufferedImage img = shootScreen2();
awt {
is.setImage(img);
infoMessage("Screenshot taken (" + img.getWidth() + "*" + img.getHeight() + " px)", 2);
}
}
});
addMenuItem(menu, "Load snippet or file...", r {
final new JTextField tf;
showFormTitled("Load image from snippet or file",
"Path or snippet ID", tf,
r {
is.setImage(loadImage2(tf.getText().trim()));
is.zoomToDisplaySize();
});
});
});
}
bool hasImage() { ret is.getImage() != null && is.getImage().getWidth()*is.getImage().getHeight() > 1; }
BWImage getBWImage() { ret is.getImage() == null ? null : new BWImage(is.getImage()); }
BufferedImage getImage() { ret hasImage() ? is.getImage() : null; }
void setImage(BufferedImage img) { is.setImage(img); is.zoomToWindow(); }
ifclass PNGFile
PNGFile createPNGFile() { ret hasImage() ? new PNGFile(getImage()) : null; }
endif
void setTitleForUpload(S title) { is.titleForUpload = title; }
}