how can I solve this image oversize problem in my simple HTML photogallery with finding images in directory by PHP? I can't solve it and it's not visually good. Can you please help me? Screenshot is
Thanks.
how can I solve this image oversize problem in my simple HTML photogallery with finding images in directory by PHP? I can't solve it and it's not visually good. Can you please help me? Screenshot is
Thanks.
Set all of the pictures with the same class, then add an image height to that class and it will set the images to all the same height.
Here is an example that i just made - http://jsfiddle.net/3gd5ooLf/
Im not sure how you are getting the image in PHP so i can't tell you how to set the class without seeing some code.
here's the CSS example:
.height {
height: 100px;
}
This may be a good example to you . Refer to stackoverflow old question too. here is the link:link
.img {
position: relative;
float: left;
width: 100px;
height: 100px;
background-position: 50% 50%;
background-repeat: no-repeat;
background-size: cover;
}
<div class="img" style="background-image:url('http://i.imgur.com/tI5jq2c.jpg');"></div>
In your css file, you could add heigth and width property to adjust the images size.
For example:
img {
heigth:200px;
width: auto;
}
will set the heigth to 200px, but will keep the aspect ratio. To have square images, set the width to, for example, 200px
If you prefer, you could set the image to be scrollable when it's too long like so:
img {
height:200px;
width:200px;
overflow: scroll;
}