The images are all of the same sizes. I use Image GIF and the size of the images on the hard disk is 415x72.
The images are placed in a table I want to make all images the same via css.
Images details on the hard disk:
view.jsp:
<%
logo ="<img src='/path/images/vendor/"+vendor.toLowerCase()+".gif' style='max-width:120px'/>";
%>
<liferay-ui:search-container-column-text name='vendor'
cssClass="width-10" value="<%=logo%>" />
Image details:
I've looked into this link, but doesn't work for me. I couldn't get any solution to work to my requirement.
I tried this code below but the picture becomes blurry.
.img {
position: relative;
float: left;
width: 100px;
height: 100px;
background-position: 50% 50%;
background-repeat: no-repeat;
background-size: cover;
}
view.jsp:
<%
logo ="<img class='img' src='/path/images/vendor/"+vendor.toLowerCase()+".gif' style='max-width:120px'/>";
%>
Images details after adding the code:
Is there a solution with the css or I have to use a software for image?
The requested result image of same size and clear:
Update:
1- I tried to change the width and set the height to auto but I did not get what I want.
2- I tried this line but did not work.
<%
logo = "<div class='img' style='background-image:url(\""+logoUrl+"\");' style='max-width:220px;'> </div>";
%>
3- I tried to resize with html tag <img>
and to cut with background-image
.
I followed this link: CSS Display an Image Resized and Cropped I did not got a good result.
<%
logo = "<div class='crop'><img class='img' src='"+logoUrl+"' style='max-width:120px;' alt='"+vendor.toLowerCase()+"'/></div>";
%>
css:
.crop {
width: 160px;
height: 120px;
overflow: hidden;
}
.crop img {
width: 565px;
height: auto;
margin: -75px 0 0 -100px;
}
Details images:
From the outside the images are the same size but from the inside they are not the same size. I want images with the same height and width without modifying the aspect ratio of the images. How can I do that?