Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function image()
- {
- $img = Asset::find($this->getParam('id'));
- $retina = $this->getParam('retina');
- if ($img->extension() == 'svg') {
- return File::get($img->resolvedPath());
- }
- $width = $retina ? $img->width() / 2 : $img->width();
- $height = $retina ? $img->height() / 2 : $img->height();
- return '<img src="' . $img->url() . '" width="'. $width .'" height="'. $height .'" alt="'. $img->get('alt') .'" />';
- }
Add Comment
Please, Sign In to add comment