-
Jul 19th, 2011, 05:43 AM
#1
How to get the image size (width and height)?
Hi, I am new to grails. I spent fare amount of time in search of finding the image size using grails but end up with nothing.
I want to find the image size (width and height) using grails by just giving path of the image. Is it possible using grails? if yes, how?
Please suggest me easy way to find the image size.
Thanks in advance,
Venkatesh
-
Jul 20th, 2011, 02:13 AM
#2
Any help is appreciated...
-
Jul 27th, 2011, 04:36 AM
#3
What image size? Is this a static resource under web-app/images of the application? Or is it an image upload? Or is it an image elsewhere? Regardless, you should have a look at the Burning Image plugin, which I believe makes it pretty easy to access this information.
-
Jul 27th, 2011, 04:46 AM
#4
thanks for your reply.
Ya it is a static resource under web-app/images of the application.
I found the solution as well, it is as shown below -
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
...
def img = ImageIO.read(new File("path/to/your/file/cherry.jpg"));
println("Width:"+img.getWidth()+" Height:"+img.getHeight());
I think it is too late response from the forum.
Regards,
Venkatesh
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules