Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resize issue #320

Open
Fragger5000 opened this issue Jan 20, 2017 · 0 comments
Open

Resize issue #320

Fragger5000 opened this issue Jan 20, 2017 · 0 comments

Comments

@Fragger5000
Copy link

Fragger5000 commented Jan 20, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant