Solved

Get Image Width and Height values

Posted on 2008-06-10
3
1,297 Views
Last Modified: 2013-11-24
I am just learning JSP, and I have been trying to get this working all day to no avail.  What I am trying to do is, using an image's path on my physical drive like "C:\myfolder\myimage.jpg", display on a webpage the width and height of the image.  I did not need to manipulate the image, so I thought this might be easy.  If anyone has some working code in JSP to solve this that would be amazing.  I am not picky right now if it is using a scriptlet, tags, or however it can be done  Thanks!
0
Comment
Question by:js_vaughan
  • 2
3 Comments
 
LVL 86

Accepted Solution

by:
CEHJ earned 500 total points
ID: 21753910
You can do something like:
BufferedImage bi = javax.imageio.ImageIO.read(new File("C:/myfolder/myimage.jpg"));

int w = bi.getWidth();

int h = bi.getHeight();

Open in new window

0
 
LVL 10

Author Closing Comment

by:js_vaughan
ID: 31465877
I figured it was going to be simple, just wasnt getting it right =P

Thanks!
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 21754088
:-)
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
This video teaches viewers about errors in exception handling.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now