jancbeck / kirby-responsive-images

Bring responsive images to Kirby CMS
66 stars 7 forks source link

Fallback/default is the only crop being pulled by broswers at all screensizes (and without a fallback set no crops are pulled) #12

Open liaprins opened 7 years ago

liaprins commented 7 years ago

I would like to achieve this equivalent (plain HTML version):

<img sizes=“(max-width: 817px) 100vw,
             1108px”
          srcset=“img-390.png 390w,
               img-650.png 650w,
               img-816.png 816w,
               img-1108.png 1108w”
          src=“img-650.png”>

So I entered this into the config.php:

c::set('responsiveimages.sizes', array( 
    'contentimage' => array(
        'size_value' => '100vw',
        'mq_value'   => '817px',
        'mq_name'    => 'max-width'
    ),
    'contentimage' => array(
        'size_value' => '1108px'
    ),
));

c::set('responsiveimages.sources', array( 
    'small'  => array('width' => 390),
    'medium' => array('width' => 650),
    'large' => array('width' => 816),
    'x-large'  => array('width' => 1108, 'grayscale' => true) // good for debugging
));

c::set('responsiveimages.defaultsource', 'medium');

When I check the thumbs folder all the crop sizes I want are being created. But I have tried several browsers and several screen sizes, and no matter what, only the default is ever the one that is loaded, even when the screen is much larger or much smaller.

Some other strange things happening (possibly clues):

Please let me know what I can do to get this plugin to work properly, and if others have had the same issue with the fallback taking over? Thank you so much!!!