0
我想我的圖片複製到Amazon S3和它的偉大工程的二進制數據,如果我能夠從圖像像這樣傳遞二進制數據:我怎麼從imagecreatefromjpeg
$binary = file_get_contents($image_location);
$response = $s3->create_object(AWS_S3_BUCKET, $image_name, array('body' => $binary, 'contentType' => $info['mime'], 'acl' => AmazonS3::ACL_PUBLIC));
哪有我從imagecreatefromjpeg得到相同的二進制數據?有更容易的方法嗎?
我目前得到的圖像資源是這樣的:
private function GetImageResource($image, $extension){
switch($extension){
case "jpeg":
case "jpg":
@ini_set('gd.jpeg_ignore_warning', 1);
$resource = imagecreatefromjpeg($image);
break;
case "gif":
$resource = imagecreatefromgif($image);
break;
case "png":
$resource = imagecreatefrompng($image);
break;
}
return $resource;
}