I am trying to create a responsive thumb image from an uploaded image. I want the thumb to be uniform in size with other thumb images. So if i upload 3 images of different dimensions, I want the thumb of 3 images to be same in dimensions and still show the image properly. If the Image is too vertical, it should be cropped and displayed.
I don’t want to set the width and height as I want the image to be responsive when displayed. Like 30% of the div or something so it can be viewed properly across multiple platforms.
Are you talking about part of an upload script? It’s unclear if this is something you want to do with PHP or a CSS layout problem. Since you post in PHP I assume that, though the end result may involve both.
PHP has a number of image functions you can use. http://php.net/manual/en/ref.image.php
Alternatively there are some new css properties that can display images in a specific aspect ratio box, cropped or otherwise, object-fit: cover may do the job for you.