aspose file tools
The moose likes JSF and the fly likes Image component problem. Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "Image component problem." Watch "Image component problem." New topic
Author

Image component problem.

Darrin Smith
Ranch Hand

Joined: Aug 04, 2003
Posts: 276
I am using an image component to display an image on a page and since I don't know ahead of time the height and width of the actual image, I don't set them at design time so the image itself determines its own size (otherwise you get aspect ratio issues).

My problem is that some of the images are very large.

Is there any way to allow the native aspect ratio to be kept but limit the maximum size that the image component can automatically grow to?

Maybe there is a way to "know" when the rednering of the image takes place, grab its height and width, calculate the aspect ratio, then scale accordingly?

Thanks!
Varun Khanna
Ranch Hand

Joined: May 30, 2002
Posts: 1400

Maybe there is a way to "know" when the rednering of the image takes place, grab its height and width, calculate the aspect ratio, then scale accordingly?

Thanks!


For this you just need to check out the image renderer.
Extend it and play around the way you want.


- Varun
Darrin Smith
Ranch Hand

Joined: Aug 04, 2003
Posts: 276
Originally posted by Varun Khanna:


For this you just need to check out the image renderer.
Extend it and play around the way you want.




Never had to write a renderer before. I guess I'll Google around for a tutorial and see what my copy of JavaServer Faces In Action book has to say.

The thing is, I'm using Creator, so hopefully everthing can integrate OK.

Thanks for the feedback!
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Image component problem.
 
Similar Threads
Crop an image in Java
How do you know the available real state in the container/framing component?
How to move Background image on resize of window
Resize an image while maintaing its aspect ratio..
Uniform Scaling