How to store a modified image and be able to see it in the files module

william - 3 weeks ago

I have the image i want to modify: $image

I modify the image: $newImage = $image->make()->crop(100,100,10,10)

Now, i want to store this $newImage to my local disk, in a directory (existing, but let's say it doesn't) called 'modified_images'.

Finally, i want to have the ID of the stored image returned and when i go to files i want to be able to see it there.

What's the best approach to this?

william - 3 weeks ago

I guess i am leaning toward Mount Manager. Am i wrong?

ryanthompson - 3 weeks ago

Something like this should do it:

$file = $manager->put("local://my_files/stupid_name.jpg", $post->cover_image->make()->resize(100, 100)->dump());

william - 3 weeks ago

Dump, Data, Output, dumpImage does not work. Data does work to save an image, however, it's not the cropped version. It's the original one.

Is that a bug? Or is it so that we don't have anything in place for this yet? And instead i should go with publish()/save and then copy/move the image with mountmanager?

william - 1 week ago

Sorted... Working on a guide.