mercredi 16 mars 2016

Stop file get contents / Intervention Image stripping exif data

I have made a class for my Laravel project that uses S3 for uploading images and intervention before hand to manage them (resize etc if needed).

I use a mixture of Dropzone.js and a few controllers etc but the process simplified is:

// image passed to class
$image = $request->file('file');

// in the class
$image = file_get_contents($image);

// intervention image work
$image = Image::make($image)->Exif();

If i return the $image, I will get 'no properties' however If I instead do:

$image = Image::make($request->file('file'))->Exif();

Then I get the data back. So it looks like the file get contents is removing the Exif?

The issue is that I get:

Allowed memory size of 134217728 bytes exhausted (tried to allocate 34560001 bytes)

When trying to upload using the later example.

So the main question is how should I be using Intervention Image to upload an image to S3 and also keep the exif data when passing it into Intervention so that I can use the orientate function?

This is the S3 line for reference and what I currently do to the Intervention Image object:

$image = $this->image->stream();
$image = $image->__toString();
$uploaded = Storage::disk('s3')->put('images/' . $fileName, $image);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire