Solved

Get Image Width and Height values

Posted on 2008-06-10
3
1,308 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…

627 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