public function __construct(array $attributes = [])
{
$place = last(explode('/', request()->server()['REQUEST_URI']));
#request()->route('place');
$this->hasAttachedFile('image_desktop', ['styles' => ['crop' => function ($file, $imagine) {
$image = $imagine->open($file->getRealPath());
if (request()->input('crop.image_desktop.w') >= 0 && request()->input('crop.image_desktop.y') >= 0) {
$image->crop(new \Imagine\Image\Point(request()->input('crop.image_desktop.x'), request()->input('crop.image_desktop.y')), new \Imagine\Image\Box(request()->input('crop.image_desktop.w'), request()->input('crop.image_desktop.h')));
}
return $image;
}], 'default_url' => 'http://placehold.it/' . config('mbanners.places.' . $place . '.desktop.width') . 'x' . config('mbanners.places.' . $place . '.desktop.height')]);
if (config('mbanners.places.' . $place . '.tablet') !== false) {
$this->hasAttachedFile('image_tablet', ['styles' => ['crop' => function ($file, $imagine) {
$image = $imagine->open($file->getRealPath());
if (request()->input('crop.image_tablet.w') >= 0 && request()->input('crop.image_tablet.y') >= 0) {
$image->crop(new \Imagine\Image\Point(request()->input('crop.image_tablet.x'), request()->input('crop.image_tablet.y')), new \Imagine\Image\Box(request()->input('crop.image_tablet.w'), request()->input('crop.image_tablet.h')));
}
return $image;
}], 'default_url' => 'http://placehold.it/' . config('mbanners.places.' . $place . '.tablet.width') . 'x' . config('mbanners.places.' . $place . '.tablet.height')]);
}
if (config('mbanners.places.' . $place . '.mobile') !== false) {
$this->hasAttachedFile('image_mobile', ['styles' => ['crop' => function ($file, $imagine) {
$image = $imagine->open($file->getRealPath());
if (request()->input('crop.image_mobile.w') >= 0 && request()->input('crop.image_mobile.y') >= 0) {
$image->crop(new \Imagine\Image\Point(request()->input('crop.image_mobile.x'), request()->input('crop.image_mobile.y')), new \Imagine\Image\Box(request()->input('crop.image_mobile.w'), request()->input('crop.image_mobile.h')));
}
return $image;
}], 'default_url' => 'http://placehold.it/' . config('mbanners.places.' . $place . '.mobile.width') . 'x' . config('mbanners.places.' . $place . '.mobile.height')]);
}
parent::__construct($attributes);
}