Reputation: 1822
I have a PHP app that uploads an image. I am using the S3 PHP Class (http://undesigned.org.za/2007/10/22/amazon-s3-php-class)
Is it possible to create a smaller thumbnail and upload it to S3 as well? I searched the web, but could not find anything.
Thanks
Upvotes: 1
Views: 2978
Reputation: 623
Once the file is uploaded to your server, you can do whatever you want with it. PHP will provide you with the temporary location of the uploaded file in the variable $_FILES['your_form_element_name']['tmp_name']
From there you can use Imagick to resize the file, and then upload the resized image to S3 alongside your original image.
Imagick has a Imagick::thumbnailImage()
method which is really easy to use.
More details on PHP file uploads here: http://www.php.net/manual/en/features.file-upload.post-method.php And more info about how to use Imagick here: http://php.net/manual/en/book.imagick.php
Upvotes: 2
Reputation: 21531
Yes its possible, there are loads of libraries that will resize images for you.
http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/
When you've resized the image just upload it in the same way.
Upvotes: 2