Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/code/Magento/Catalog/Model/Product/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public function getQuality()
*/
public function setKeepAspectRatio($keep)
{
$this->_keepAspectRatio = (bool)$keep;
$this->_keepAspectRatio = $keep && $keep !== 'false';
Copy link

@eldonbite eldonbite Jan 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, you could probably just do a json_decode($keep) here..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even if json_decode works it would be much slower and much less clear.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, point well-taken 👍

return $this;
}

Expand All @@ -288,7 +288,7 @@ public function setKeepAspectRatio($keep)
*/
public function setKeepFrame($keep)
{
$this->_keepFrame = (bool)$keep;
$this->_keepFrame = $keep && $keep !== 'false';
return $this;
}

Expand All @@ -298,7 +298,7 @@ public function setKeepFrame($keep)
*/
public function setKeepTransparency($keep)
{
$this->_keepTransparency = (bool)$keep;
$this->_keepTransparency = $keep && $keep !== 'false';
return $this;
}

Expand All @@ -308,7 +308,7 @@ public function setKeepTransparency($keep)
*/
public function setConstrainOnly($flag)
{
$this->_constrainOnly = (bool)$flag;
$this->_constrainOnly = $flag && $flag !== 'false';
return $this;
}

Expand Down