diff --git a/src/Pass/PinterestTagTransformPass.php b/src/Pass/PinterestTagTransformPass.php
index 30827311..51a8a38d 100644
--- a/src/Pass/PinterestTagTransformPass.php
+++ b/src/Pass/PinterestTagTransformPass.php
@@ -93,13 +93,21 @@ protected function setPinterestDimensionsFrom(DOMQuery $el, DOMQuery $new_el)
$width = $el->attr('width');
$height = $el->attr('height');
+
+ if (!empty($height) && empty($width)) {
+ $width = 'auto';
+ }
+
$hw_available = !empty($width) && !empty($height);
$new_el->attr('data-pin-width', $pin_width);
if ($hw_available) {
$new_el->attr('width', $width);
$new_el->attr('height', $height);
- } else {
+ $new_el->attr('layout', $width == 'auto' ? 'fixed-height' : 'fixed');
+ }
+ else {
$new_el->attr($dimensions[$pin_width]);
+ $new_el->attr('layout', 'responsive');
}
}
}
diff --git a/tests/test-data/fragment-html/pinterest-fragment.html.out b/tests/test-data/fragment-html/pinterest-fragment.html.out
index 8aeab260..fd5b62a7 100644
--- a/tests/test-data/fragment-html/pinterest-fragment.html.out
+++ b/tests/test-data/fragment-html/pinterest-fragment.html.out
@@ -1,4 +1,4 @@
-
+
ORIGINAL HTML