<commit_before># Amazon S3 Image processor

#### by [Cuatromedios](http://www.cuatromedios.com/)
 
 Takes an image from an Amazon S3 bucket, process it, and then stores the result in another bucket. If you configure the S3 Bucket to redirect not found images to this script, the images will be generated on demand without exposing the original file. The next time another user ask for the same image in S3 url, the image will be served from S3 not consuming more bandwidth or process time of the application.
 
 ### This is how the magic happens:
 
 1. Manually or with your content management system, you upload your original images to your Amazon S3 **source bucket**. For example: ```source-bucket/image.jpg```
 2. In your templates / html files you call the images as if they exist in your **destination bucket** (destination-bucket) using the special **endpoint** provided by amazon in Static Website hosting but you append the preset as a directory, for example: ```https://destination-bucket.s3-website-us-west-1.amazonaws.com/thumb/image.jpg```
 3. Because the image does not exist, Amazon will redirect the call to your application, for example: ```https://your-application.com/thumb/image.jpg```
 4. The object name, ```image.jpg``` will be searched in your source-bucket and then download it
 5. The application will take the frist directory ```thumb``` as a preset and will look for it in your configuration, the will process the image (for example resize it) and then:
     1. Send to the client the result image
     2. Send to destination bucket the result image
 6. The next time a user request the image from Amazon, it will **NOT** be redirected to your application because the image will be there already!
 
 ## Configuration
 
 ### Prepare Amazon S3
 
 1. You will need two Amazon S3 buckets, source and destination, create them in Amazon Web Services
 2. Go to IAM Service and create a new user or choose any user you have defined there. You will need the Access Key ID and Secret Access Key
 3. Be sure the user has at least read permissions in the source bucket and write permissions in destination bucket:
    1. Select the user and click on Permissions Tab
    2. Open "Inline Policies" section
    3. Click on "click here" link in "There are no inline policies to show. To create one, click here." messge
    4. Select Policy Generator
    5. Be sure to:
        1. Choose: Effect allow<commit_msg>Formatting the README.md<commit_after># Amazon S3 Image processor

#### by [Cuatromedios](http://www.cuatromedios.com/)
 
 Takes an image from an Amazon S3 bucket, process it, and then stores the result in another bucket. If you configure the S3 Bucket to redirect not found images to this script, the images will be generated on demand without exposing the original file. The next time another user ask for the same image in S3 url, the image will be served from S3 not consuming more bandwidth or process time of the application.
 
### This is how the magic happens:
 
 1. Manually or with your content management system, you upload your original images to your Amazon S3 **source bucket**. For example: ```source-bucket/image.jpg```
 2. In your templates / html files you call the images as if they exist in your **destination bucket** (destination-bucket) using the special **endpoint** provided by amazon in Static Website hosting but you append the preset as a directory, for example: ```https://destination-bucket.s3-website-us-west-1.amazonaws.com/thumb/image.jpg```
 3. Because the image does not exist, Amazon will redirect the call to your application, for example: ```https://your-application.com/thumb/image.jpg```
 4. The object name, ```image.jpg``` will be searched in your source-bucket and then download it
 5. The application will take the frist directory ```thumb``` as a preset and will look for it in your configuration, the will process the image (for example resize it) and then:
     1. Send to the client the result image
     2. Send to destination bucket the result image
 6. The next time a user request the image from Amazon, it will **NOT** be redirected to your application because the image will be there already!
 
 ## Configuration
 
 ### Prepare Amazon S3
 
 1. You will need two Amazon S3 buckets, source and destination, create them in Amazon Web Services
 2. Go to IAM Service and create a new user or choose any user you have defined there. You will need the Access Key ID and Secret Access Key
 3. Be sure the user has at least read permissions in the source bucket and write permissions in destination bucket:
    1. Select the user and click on Permissions Tab
    2. Open "Inline Policies" section
    3. Click on "click here" link in "There are no inline policies to show. To create one, click here." messge
    4. Select Policy Generator
    5. Be sure to:
        1. Choose: Effect allow
{'fraction_non_alphanumeric': 0.06525319061342116, 'fraction_numerical': 0.011115685467270481, 'mean_word_length': 3.8834170854271357, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3968030', 'n_tokens_mistral': 1231, 'n_tokens_neox': 1180, 'n_words': 745}