switch to new srcset spec

This commit is contained in:
Gert
2015-01-25 15:47:23 +01:00
parent f7470ace97
commit c010ae3a97
2 changed files with 4 additions and 2 deletions

View File

@@ -144,6 +144,7 @@ trait ParsedownGravTrait
if (!isset($actions['lightbox']) && !is_array($src)) {
$excerpt['element']['attributes']['src'] = $src;
$excerpt['element']['attributes']['srcset'] = $srcset;
$excerpt['element']['attributes']['sizes'] = '100vw';
} else {
// Create the custom lightbox element
$element = array(
@@ -155,6 +156,7 @@ trait ParsedownGravTrait
'attributes' => array(
'src' => $src['img_url'],
'srcset' => $srcset,
'sizes' => '(min-width: 36em) 80vw, 100vw',
'alt' => $alt,
'title' => $title
)

View File

@@ -163,10 +163,10 @@ class Medium extends Data
*/
public function srcset()
{
$srcset = [ $this->url() . $this->get('width') . 'w' ];
$srcset = [ $this->url() . ' ' . $this->get('width') . 'w' ];
foreach ($this->alternatives as $type => $medium) {
$srcset[] = $medium->url() . ' ' . $type;
$srcset[] = $medium->url() . ' ' . $medium->get('width') . 'w';
}
return implode(', ', $srcset);