Display image in div , in case its height is more than width (portrait), show mid part of image
Dear Sir
pls refer
all images in landscape (height less than width) like
are properly aligned
however the images in portrait (height more than width)
like
or
only top part is visible
for landscape images there is no issue
However in case of Portrait type of images (where in the height is more than width)
only top part is visible
I want to show mid part of the image in case of portrait type of image instead of top part
i feel this is possible using jquery
pls pls help
I tried
used css as follow
- /* Thumbnail styling */
-
- .thumbnail {
- position: relative;
- width: 200px;
- height: 200px;
- overflow: hidden;
- }
- .thumbnail img {
- position: absolute;
- left: 50%;
- top: 50%;
- height: 100%;
- width: auto;
- -webkit-transform: translate(-50%,-50%);
- -ms-transform: translate(-50%,-50%);
- transform: translate(-50%,-50%);
- }
- .thumbnail img.portrait {
- width: 100%;
- height: auto;
- }
and PHP script as follow (dynamic ...image names are fetched from database)
- <div class="thumbnail">
- <img src="<?php echo $srows['actualimage'];?>" style="border:3px solid #ccc ;" >
- </div>
however being responsive (my personal opinion)
the crop is not working
refer following link after using crop
in need of solution