Stretch too short image for image size
-
Hello,
I have own:
add_image_size( 'featured-image', 1200, 335, true );
However, I am migrating from old Joomla and have images with max width 800px.
My post image in full-width page is exactly 1200x335px. I am usingmax-height: 335px;
for div parent, so it’s nicely responsive.Problem is if I’ll upload for example 800x600px
'featured-image'
is created in 800x335px with hard crop. My css stretch it to 1200px withwidth: 100%
, but I have additional image areas on top and bottom of image (800px -> 1200px: 1,5 so 335px * 1,5 = 502,5px).I can’t force div parent for
height: 335px;
so I could vertical center image by this, because responsivemax-height: 335px;
.I need to WordPress creates 1200x335px or 800x223px (height – 335px / 1,5), so then css will stretch it right.
JSFiddle (without JS) – unexpected result two issues: higher in expected in zoom-in and bad placed in zoom-out.
My all known ways to find solution – used.
Thanks in advance!
Greetings
- The topic ‘Stretch too short image for image size’ is closed to new replies.