dimanche 28 février 2016

How to processing an image downloaded from AWS S3 with Laravel 5?

I want download an image from AWS S3 and process it with php. I am using "imagecreatefromjpeg" and "getimagesize" to process my image but it seem that

Storage::disk('s3')->get(imageUrlonS3);

retrieve the image in binary and is giving me errors. This is my code:

function createSlices($imagePath) {

                //create transform driver object
                $im = imagecreatefromjpeg($imagePath);
                $sizeArray = getimagesize($imagePath);

                //Set the Image dimensions
                $imageWidth = $sizeArray[0];
                $imageHeight = $sizeArray[1];

                //See how many zoom levels are required for the width and height
                $widthLog = ceil(log($imageWidth/256,2));
                $heightLog = ceil(log($imageHeight/256,2));


                //more code here to slice the image
                .
                .
                .
                .
            }

            // ex: http://ift.tt/1XTGaTF
            $content = Storage::disk('s3')->get(imageUrlonS3);
            createSlices($content);

What am I missing here ?

Thanks



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1UsN9Dt
via IFTTT

Aucun commentaire:

Enregistrer un commentaire