Skip to content

Commit

Permalink
Update RetinaImageExtension.php
Browse files Browse the repository at this point in the history
  • Loading branch information
torleif authored Jun 28, 2022
1 parent 02679b1 commit c62b259
Showing 1 changed file with 27 additions and 43 deletions.
70 changes: 27 additions & 43 deletions src/RetinaImageExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,12 @@ public function RetinaFill($width, $height)
return $this->owner->Fill($width, $height);
}

return HTML::createTag('img', [
'alt' => $this->owner->Title,
return HTML::createTag('img', array_merge($img1->getAttributes(), [
'src' => $img1->getURL(),
'srcset' => $img1->getURL() . ' 1x, ' . $img2->getURL() . ' 1.5x,' . $img3->getURL() . ' 2x'
]);
]));
}

/**
* @param int $width
* @param int $height
Expand All @@ -65,16 +64,17 @@ public function RetinaFillMax($width, $height)
return $this->owner->FillMax($width, $height);
}

return HTML::createTag('img', [
'alt' => $this->owner->Title,
return HTML::createTag('img', array_merge($img1->getAttributes(), [
'src' => $img1->getURL(),
'srcset' => $img1->getURL() . ' 1x, ' . $img2->getURL() . ' 1.5x,' . $img3->getURL() . ' 2x'
]);
]));
}

/**
* @param int $width
* @param int $height
* @param string $backgroundColor
* @param float $transparencyPercent
* @return html
*/
public function RetinaPad($width, $height, $backgroundColor = 'FFFFFF', $transparencyPercent = 0)
Expand All @@ -87,11 +87,10 @@ public function RetinaPad($width, $height, $backgroundColor = 'FFFFFF', $transpa
return $this->owner->Pad($width, $height, $backgroundColor, $transparencyPercent);
}

return HTML::createTag('img', [
'alt' => $this->owner->Title,
return HTML::createTag('img', array_merge($img1->getAttributes(), [
'src' => $img1->getURL(),
'srcset' => $img1->getURL() . ' 1x, ' . $img2->getURL() . ' 1.5x,' . $img3->getURL() . ' 2x'
]);
]));
}

/**
Expand All @@ -109,11 +108,10 @@ public function RetinaFitMax($width, $height)
return $this->owner->FitMax($width, $height);
}

return HTML::createTag('img', [
'alt' => $this->owner->Title,
return HTML::createTag('img', array_merge($img1->getAttributes(), [
'src' => $img1->getURL(),
'srcset' => $img1->getURL() . ' 1x, ' . $img2->getURL() . ' 1.5x,' . $img3->getURL() . ' 2x'
]);
]));
}

/**
Expand All @@ -131,11 +129,10 @@ public function RetinaResizedImage($width, $height)
return $this->owner->ResizedImage($width, $height);
}

return HTML::createTag('img', [
'alt' => $this->owner->Title,
return HTML::createTag('img', array_merge($img1->getAttributes(), [
'src' => $img1->getURL(),
'srcset' => $img1->getURL() . ' 1x, ' . $img2->getURL() . ' 1.5x,' . $img3->getURL() . ' 2x'
]);
]));
}
/**
* @param int $width
Expand All @@ -152,16 +149,14 @@ public function RetinaFit($width, $height)
return $this->owner->Fit($width, $height);
}

return HTML::createTag('img', [
'alt' => $this->owner->Title,
return HTML::createTag('img', array_merge($img1->getAttributes(), [
'src' => $img1->getURL(),
'srcset' => $img1->getURL() . ' 1x, ' . $img2->getURL() . ' 1.5x,' . $img3->getURL() . ' 2x'
]);
]));
}

/**
* @param int $width
* @param int $height
* @return html
*/
public function RetinaCropWidth($width)
Expand All @@ -174,16 +169,14 @@ public function RetinaCropWidth($width)
return $this->owner->CropWidth($width);
}

return HTML::createTag('img', [
'alt' => $this->owner->Title,
return HTML::createTag('img', array_merge($img1->getAttributes(), [
'src' => $img1->getURL(),
'srcset' => $img1->getURL() . ' 1x, ' . $img2->getURL() . ' 1.5x,' . $img3->getURL() . ' 2x'
]);
]));
}

/**
* @param int $width
* @param int $height
* @return html
*/
public function RetinaCropHeight($width)
Expand All @@ -196,16 +189,14 @@ public function RetinaCropHeight($width)
return $this->owner->CropHeight($width);
}

return HTML::createTag('img', [
'alt' => $this->owner->Title,
return HTML::createTag('img', array_merge($img1->getAttributes(), [
'src' => $img1->getURL(),
'srcset' => $img1->getURL() . ' 1x, ' . $img2->getURL() . ' 1.5x,' . $img3->getURL() . ' 2x'
]);
]));
}

/**
* @param int $width
* @param int $height
* @return html
*/
public function RetinaScaleWidth($width)
Expand All @@ -218,16 +209,14 @@ public function RetinaScaleWidth($width)
return $this->owner->ScaleWidth($width);
}

return HTML::createTag('img', [
'alt' => $this->owner->Title,
return HTML::createTag('img', array_merge($img1->getAttributes(), [
'src' => $img1->getURL(),
'srcset' => $img1->getURL() . ' 1x, ' . $img2->getURL() . ' 1.5x,' . $img3->getURL() . ' 2x'
]);
]));
}

/**
* @param int $width
* @param int $height
* @return html
*/
public function RetinaScaleMaxWidth($width)
Expand All @@ -240,16 +229,14 @@ public function RetinaScaleMaxWidth($width)
return $this->owner->ScaleMaxWidth($width);
}

return HTML::createTag('img', [
'alt' => $this->owner->Title,
return HTML::createTag('img', array_merge($img1->getAttributes(), [
'src' => $img1->getURL(),
'srcset' => $img1->getURL() . ' 1x, ' . $img2->getURL() . ' 1.5x,' . $img3->getURL() . ' 2x'
]);
]));
}

/**
* @param int $width
* @param int $height
* @return html
*/
public function RetinaScaleMaxHeight($width)
Expand All @@ -262,16 +249,14 @@ public function RetinaScaleMaxHeight($width)
return $this->owner->ScaleMaxHeight($width);
}

return HTML::createTag('img', [
'alt' => $this->owner->Title,
return HTML::createTag('img', array_merge($img1->getAttributes(), [
'src' => $img1->getURL(),
'srcset' => $img1->getURL() . ' 1x, ' . $img2->getURL() . ' 1.5x,' . $img3->getURL() . ' 2x'
]);
]));
}

/**
* @param int $width
* @param int $height
* @return html
*/
public function RetinaScaleHeight($width)
Expand All @@ -284,10 +269,9 @@ public function RetinaScaleHeight($width)
return $this->owner->ScaleHeight($width);
}

return HTML::createTag('img', [
'alt' => $this->owner->Title,
return HTML::createTag('img', array_merge($img1->getAttributes(), [
'src' => $img1->getURL(),
'srcset' => $img1->getURL() . ' 1x, ' . $img2->getURL() . ' 1.5x,' . $img3->getURL() . ' 2x'
]);
]));
}
}

0 comments on commit c62b259

Please sign in to comment.