I'm trying to copy my images to Amazon S3 and it works great if I can pass it the binary data from the image like so:
$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));
How can I get the same binary data from imagecreatefromjpeg? Is there an easier way?
I'm currently getting the image resource this way:
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;
}