laravel-image-legacy icon indicating copy to clipboard operation
laravel-image-legacy copied to clipboard

Image::url returning url but image is not resized

Open danielgroppo opened this issue 7 years ago • 2 comments

I'm trying to use this on Laravel 4.2, I have installed Imagine too and followed all steps (config publish, inclusive) with no error. When I call Image::url to make a resize of an image, this returns the url but the new image is not generated on the path.

Image::url($content->original_file_url,300,300)

If this line return the new url, the package is working in part, why the new image is not being generated?

danielgroppo avatar Apr 17 '17 21:04 danielgroppo

The image is not generated by this command. This is just a helper to get a route to the image like path/to/picture-image(300x300).jpg.

The image itself is created and returned when you actually call the url in the browser or similiarly. If you want the image not to be recreated every time but to be stored in your filesystem, you have to also specify write_image to be true in the config file (publish it first if you haven't done it).

P.S. Not sure about the recommended way, I usually either do url().Image::url($content->original_file_url,300,300) or asset(Image::url($content->original_file_url,300,300)) to get the absolute URL of the image.

tontonsb avatar May 19 '17 09:05 tontonsb

You can also use

{{ Image::url(url('path/to/image'), 360, 470, ['crop' => true]) }}

91Abdullah avatar Jul 08 '17 08:07 91Abdullah