Christian Koch
unread,Aug 28, 2011, 4:46:05 AM8/28/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to play-framework
Hi, in our current project we have to resize an to crop some images
stored in the database. it looks like
try {
File fileOut = File.createTempFile("tmp", ".image");
File fileIn = image.original.getFile();
Images.crop(fileIn, fileOut,
(int)((double)x1*baseFactor),
(int)((double)y1*baseFactor),
(int)((double)x2*baseFactor),
(int)((double)y2*baseFactor)
);
image.image.set(new FileInputStream(fileOut),
MimeTypes.getContentType(image.fileName));
image.save();
renderJSON("{success: true}");
} catch (IOException e) {
e.printStackTrace();
renderJSON("{success: false}");
}
and I get the following exception.
Caused by: javax.imageio.IIOException: Can't read input file!
at javax.imageio.ImageIO.read(ImageIO.java:1275)
at play.libs.Images.crop(Images.java:104)
Can anybody tell me my fault. I don't find it.
Thanks,
Christian