-
Notifications
You must be signed in to change notification settings - Fork 17
ImageResource
Mark Reeves edited this page Jan 4, 2018
·
2 revisions
ImageResource is a specific type of InternalResource which implements Image. An ImageResource represents an image. For web purposes this is generally an image of MIME type image/jpg
or image/png
but could be any image file. An InternalResource is used when an image is in the Java class path but not in the application.
ImageResource is used by WImage.
The ImageResource description is a text description of an image most commonly used to provide the alt
attribute content of an img element.
ImageResource pngResource = new ImageResource("/path/to/flag.png", "flag");
pngResource.getDescription(); // returns "flag"
ImageResource size is a java.awt.Dimension
which is exposed using getSize()
.
The MIME type of the underlying image is exposed using getMimeType()
.
ImageResource pngResource = new ImageResource("/path/to/flag.png", "flag");
pngResource.getMimeType(); // returns "image/png"
To be continued