Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help in JSP / JSTL Getting Image Width And Height

 
caleb momanyi
Ranch Hand
Posts: 43
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ranchers I need to compare the height to the width of an img. How can i accomplish this using JSTL? Or simply how can i get the width and height of an image using JSTL?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65116
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSP and the JSTL will be of no help; image manipulation is not their job. You'll need to use the image manipulation APIs of Java if you want to do this on the server.

What are you actually trying to accomplish?
 
caleb momanyi
Ranch Hand
Posts: 43
Firefox Browser Java Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
to scale an image without distorting its aspect ratio so that i can dispay it in a divide which has fixed height and width. But i managed to do that by not specifying the width and height in the img tag and in my css
[CODE]
myImgDiv img{
max-width: 100%;
max-height: 100%;
}
[CODE
] it works.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic