2

I installed Laravel Intervention Image class by composer, from this tutorial, And when I type composer update, composer returns:

D:\WEB\htdocs\zanbil>composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing intervention/image (dev-master b91b0d6)
    Downloading: 100%
    Downloading: 100%

intervention/image suggests installing intervention/imagecache (Caching extension for the Intervention Image library)
intervention/image suggests installing ext-imagick (to use Imagick based image processing.)
Writing lock file
Generating autoload files
Generating optimized class loader

And this is what I am going to use with Intervention Image:

$image=Input::file('image');
        $name = Input::file('image')->getClientOriginalName();
        var_dump(Image::make($image->getRealPath()->resize('280','280')->save('public/up/city/'.$name)));

And when I run that code Laravel return (with browser):

Symfony \ Component \ Debug \ Exception \ FatalErrorException (E_ERROR) Call to a member function resize() on a non-object

What is the Problem?

Community
  • 1
  • 1
  • 1
    You call `resize` on the result of `getRealPath()`. I think you want to do something like this instead: `Image::make($image->getRealPath())->resize('280', '280')->save('public/up/city/'.$name)` – lukasgeiter Jan 14 '15 at 09:25
  • You're welcome. I voted to close since it's just a typo and it's unlikely it will help someone else in the future. – lukasgeiter Jan 14 '15 at 10:36
  • @lukasgeiter Somehow your solution not working for me as it says: *Image source not readable* – Volatil3 Feb 26 '15 at 16:11
  • @Volatil3 Then your problem is probably unrelated to this post. Please ask a new question. – lukasgeiter Feb 26 '15 at 16:14
  • @lukasgeiter Ok done: http://stackoverflow.com/questions/28747580/intervention-not-resizing-large-files – Volatil3 Feb 26 '15 at 16:26

1 Answers1

3

You call resize on the result of getRealPath(). I think you want to do something like this instead:

Image::make($image->getRealPath())->resize('280', '280')->save('public/up/city/'.$name)

Thanks lukasgeiter for Answer

Community
  • 1
  • 1