| ManuLocation : Paris / France Member since : Apr 29, 2003
 Messages : 394
 |  Aug 5, 2003 at 2:08 PM You can do it using a class that implements the java.awt.image.ImageObserver interface or by using a MediaTracker instance to synchronize the Image load process and then calling the getHeight and getWidth methods with a null parameter. 
For example, this JSP code displays the width and height of an image :
 ------
 <%@ page import="java.awt.*,java.awt.image.*" %>
 <% Image im = Toolkit.getDefaultToolkit().getImage ("/path/to/imageFile");
 MediaTracker tracker = new MediaTracker(new Frame());
 tracker.addImage(im, 0);
 tracker.waitForAll (); %>
 Image size : <%= im.getWidth (null) %>, <%= im.getHeight (null) %>
 ---
 Manu (moderator/modérateur)
 |