imageSwitch and aspect ratio

UI Components for JSF
Post Reply
jmg
Posts: 15
Joined: 21 Nov 2017, 12:11

16 Dec 2017, 03:47

Hello!

When I use ONLY a simple <p:graphicImage> with width:100% it keeps by default the aspect ratio of the picture and, in addition, resizes when the browser is resized.
To my surprise, I have found that images inside imageSwitch are displayed with its original size, not keeping such aspect ratio and not being resized when the size of the browser is changed.
I would like that pictures displayed by imageSwitch kept its aspect ratio, is that possible?

The imageSwitch:

Code: Select all

<p:imageSwitch id="galleryswitch" effect="fade" styleClass="pictures_galery" >  
	<ui:repeat id="repeater" value="#{backingBean.pictureList}" var="image">  
		<p:graphicImage id="theimage" value="/images/#{image}" width="100%" height="100%"/>  
	</ui:repeat>  
</p:imageSwitch>
The backing bean:

Code: Select all

private ArrayList<String> pictureList = new ArrayList<String>();

@PostConstruct
public void init() {
	pictureList.add("a.png");
	pictureList.add("b.png");
}
The CSS:

Code: Select all

.pictures_galery{
        width: 100%; 
        max-height:40vh !important; 
}
Any help/alternative to imageSwitch?

Thanks in advance!
I work with Eclipse Mars.2, Java 1.8 update 102 for 64bits, JSF Mojarra 2.2.2, Primefaces 6.1 and Tomcat 7.0.53.
I usually use Maven, Spring 3.2.3 and Hibernate 4.3 (MySQL 5.1.39)

Post Reply

Return to “PrimeFaces”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 49 guests