Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Image component problem.

 
Darrin Smith
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1400
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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.
 
Darrin Smith
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!