Is there a line of code to do this or not?

youveggie

Power Member
Joined
Nov 13, 2017
Messages
526
Reaction score
384
Hey guys, long time since I posted here, just busy with my new projects, but i'm not gone, still spending 1-2 hours a day on bhw :))

So my question is: Is there a tool or line of code or anything else to resize image so the thumbnails of images are shown all at the same size? it would save me a ton of work.. I will add a picture so you can see what im talking about ---> https://ibb.co/nCCBn1M

Thanks and have a wonderful holiday season :)

cya.
 
You could resize through CSS, create a class for all images, where one side (height) is fixed and the other set to auto. Something like this
.imgsz {
height: 150px;
width: auto;
}
 
You could resize through CSS, create a class for all images, where one side (height) is fixed and the other set to auto. Something like this
.imgsz {
height: 150px;
width: auto;
}
Thanks for your answer!
Great idea! In this case will the image save the quality and the look of it, or it will be stretched/ and what about aspect ratio?
 
Thread moved.
 
You could resize through CSS, create a class for all images, where one side (height) is fixed and the other set to auto. Something like this
.imgsz {
height: 150px;
width: auto;
}
This needs to be on the container, not the image itself. Otherwise images won't scale evenly.
 
If you’re using WordPress then yes there’s a way via PHP, I did it by making a small function for a plugin I’m working on that’s not directly related with that

Edit: It doesn’t make changes via CSS, the function I’m talking about just duplicate and resize any uploaded image to a concrete dimensions
 
You have to test this, it depends on the images and if there's a container. I think your best choice would be to set a container first using a class as described above, then have a new CSS class that makes images fit the container with max-width and max-height
 
Whatever the platform you use, Wordpress for example generates, when uploadloading an image, thumbnails in various sizes,
you should always prepare your images before uploading, to assure a good loom and feel on your site.
A nice and free tool that I use to resize and rename images in bulk is birme.net
But you could write code to resize and do other image manipulations on the fly.
 
Thanks for your answer!
Great idea! In this case will the image save the quality and the look of it, or it will be stretched/ and what about aspect ratio?
Set the fixed height in css to the lowest image height
 
Back
Top