Skip to content

Commit

Permalink
Fastly CDN compatibility (and potentially other extensions).
Browse files Browse the repository at this point in the history
  • Loading branch information
Edwin Westerhoud committed Sep 5, 2018
1 parent 5a8b769 commit b3f9155
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Model/OptimizableImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,15 @@ protected function getImageAsset()
the image asset property. See:
https://github.com/magento/magento2/pull/9503 */
$class = new \ReflectionClass($this->image);
$property = $class->getParentClass()->getProperty("imageAsset");

/* Some extensions subclass the image class, so we need find the parent
class that has the imageAsset property */
$parent = $class->getParentClass();
while (!$parent->hasProperty("imageAsset")) {
$parent = $parent->getParentClass();
}

$property = $parent->getProperty("imageAsset");
$property->setAccessible(true);

return $property->getValue($this->image);
Expand Down

0 comments on commit b3f9155

Please sign in to comment.