我想從AWS S3下載圖像並使用php進行處理。我使用「imagecreatefromjpeg」和「getimagesize」來處理我的圖像,但它似乎是如何使用Laravel 5處理從AWS S3下載的圖像?
Storage :: disk('s3') - > get(imageUrlonS3);
檢索二進制圖像,並給我錯誤。這是我的代碼:
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: https://s3-us-west-2.amazonaws.com/bucketname/image.jpg
$content = Storage::disk('s3')->get(imageUrlonS3);
createSlices($content);
我在這裏錯過了什麼?
感謝
你能提供確切的錯誤,你看到了嗎? – Castaglia