Hi guys, i have a grails project with an Image Domain Class and Controller. I just installed the grails ImageTools 1.0.4 Plugin and i would like to generate thumbnails for images wich will be uploaded.
My Image-Domain-Class:
class Image {
byte[] data
//String name
byte[] thumbnail
static constraints = {
//name()
data()
}
}
The "safe"-action in my Controller:
def save = {
def imageInstance = new Image(params)
def imageTool = new ImageTool()
imageTool.load(imageInstance.data)
imageTool.thumbnail(320)
imageInstance.thumbnail = imageTool.getBytes("JPEG") //Here is my problem!
if(!imageInstance.hasErrors() && imageInstance.save()) {
flash.message = "Image ${imageInstance.id} created"
redirect(action:show,id:imageInstance.id)
}
else {
render(view:'create',model:[imageInstance:imageInstance])
}
}
When I start my Grails-application and uploading an image I'm getting the following error-message:
Error 200: groovy.lang.MissingMethodException: No signature of method: ImageTool.getBytes() is applicable for argument types: (java.lang.String) values: {"JPEG"} Servlet: grails URI: /grailsproject/grails/image/save.dispatch Exception Message: No signature of method: ImageTool.getBytes() is applicable for argument types: (java.lang.String) values: {"JPEG"} Caused by: groovy.lang.MissingMethodException: No signature of method: ImageTool.getBytes() is applicable for argument types: (java.lang.String) values: {"JPEG"} Class: GrailsAuthenticationProcessingFilter At Line: [57]
It says that the Method getBytes() is missing but the method is still available. My IDE intelliJ also recognizes no errors.
So what can I do? Could someone help me please? Sorry for my bad english. If you are german, please look at http://support-network.info/board/problem-mit-imagetools-getbytes-t3008.html .