You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// resize the image to a width of 300 and constrain aspect ratio (auto height) , moreover I prevent possible upsizing $img->resize(300, null, function ($constraint) { $constraint->aspectRatio(); $constraint->upsize(); });
so I tried to do the same in LaravelPanel
$this->edit->add('immagine', 'Immagine', 'image')->rule('mimes:jpg,jpeg')->move('art_img/')->resize(240, null, function ($constraint) { $constraint->aspectRatio(); $constraint->upsize(); });
Unfortunately I get this error:
[2017-01-20 12:15:49] local.ERROR: exception 'ErrorException' with message 'pathinfo() expects parameter 1 to be string, object given' in C:\xampp\htdocs\my_project\vendor\intervention\image\src\Intervention\Image\Image.php:139
Am I doing something wrong?
In this moment I'm using a temporary (yet barbaric) workaround:
According to this article http://image.intervention.io/api/resize , the proportional resize of an image is very simple
// resize the image to a width of 300 and constrain aspect ratio (auto height) , moreover I prevent possible upsizing $img->resize(300, null, function ($constraint) { $constraint->aspectRatio(); $constraint->upsize(); });
so I tried to do the same in LaravelPanel
$this->edit->add('immagine', 'Immagine', 'image')->rule('mimes:jpg,jpeg')->move('art_img/')->resize(240, null, function ($constraint) { $constraint->aspectRatio(); $constraint->upsize(); });
Unfortunately I get this error:
[2017-01-20 12:15:49] local.ERROR: exception 'ErrorException' with message 'pathinfo() expects parameter 1 to be string, object given' in C:\xampp\htdocs\my_project\vendor\intervention\image\src\Intervention\Image\Image.php:139
Am I doing something wrong?
In this moment I'm using a temporary (yet barbaric) workaround:
$y = round(240/1.33, 0, PHP_ROUND_HALF_DOWN); $this->edit->add('immagine', 'Immagine', 'image')->rule('mimes:jpg,jpeg')->move('art_img/')->resize(240,$y);
Clearly I prefer to use the full potential of Intervention image.
The text was updated successfully, but these errors were encountered: