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>
Code: Select all
private ArrayList<String> pictureList = new ArrayList<String>();
@PostConstruct
public void init() {
pictureList.add("a.png");
pictureList.add("b.png");
}
Code: Select all
.pictures_galery{
width: 100%;
max-height:40vh !important;
}
Thanks in advance!