I'm using the jquery file upload script and have had success uploading the main image to Amazon S3. I'm now trying to swap out the multiple image sizes for uploads to sub folders or objects in S3.
Inside the create_scaled_image function in the UploadHandler.php file how do I replace the imagecopyresampled call with an S3 call? Is this even possible?
Here is what does the image resizing and writes the file out:
$success = $src_img && @imagecopyresampled(
$new_img,
$src_img,
$dst_x,
$dst_y,
0,
0,
$new_width,
$new_height,
$img_width,
$img_height
) && $write_image($new_img, $new_file_path, $image_quality);
// Free up memory (imagedestroy does not delete files):
@imagedestroy($src_img);
@imagedestroy($new_img);
Can I somehow resize the image in memory and then save the file to my S3 object?
$bucket = "pics.mysite.com";
$file = ??
$uploaded_file = ??
$response = $s3->create_object($bucket, $file, array('fileUpload' => $uploaded_file, 'acl' => AmazonS3::ACL_PUBLIC));
if ($response->isOK()) {
//success
}