I'm trying to make thumb and preserve its original proportions. Thumb's div should have width:189px and height 179px. But now, the thumb itself has bigger height and proportions are different. How to do that?
I'm trying with this:
<div class="thumbnail image-thumbnail">
<a href="someurl"><img src="thumb_src" class="thumb"/></a>
</div>
.thumbnail {
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
display: block;
line-height: 1.42857;
margin-bottom: 20px;
padding: 4px;
transition: all 0.2s ease-in-out 0s;
}
.image-thumbnail {
border: 0 none;
float: left;
margin-right: 1%;
margin-top: 10px;
padding: 0 !important;
width: 19.2%;
}
.thumb {
display: block !important;
max-height: 178px;
min-height: 178px;
min-width: 100%;
}
$max_width = 289;
$path = $_REQUEST['path'];
list($orig_width, $orig_height) = getimagesize($path);
$width = $orig_width;
$height = $orig_height;
# wider
if ($width > $max_width) {
$height = ($max_width / $width) * $height;
$width = $max_width;
}
$image = Image::factory ( $path, 'GD' );
$image->resize($width,$height)->save($tmbPath,100);