photo-resizer is an application written in Go for converting large jpg images of any resolution to the size of the iPhone 11 Pro screen resolution. It resizes the images proportionally to a width of 2436 pixels.
This project allows for the application to run locally or on AWS Lambda using Amazon S3 for storage of the images. This has been adapted from: https://github.com/nfnt/resize to allow for scalable adornment of photos.
Test images provided free from unsplash.com
Current
Local implementation allows for resizing of mulitple images in a folder
AWS implementation only allows for resizing a single image
Youtube Video
I talk about what DevOps is and how you can use AWS as a tool for DevOps. I walk through creating and provisioning an IAM user as well as connecting that user to a CodeCommit repo. You can view the video:
https://youtu.be/WlnMekNAZaw
Usage
Local
How to run:
Navigate to src/local/
Create 2 directories named "input" and "output"
Add jpg images you want to resize to "input" directory
Run "go run main.go"
View the resized images in src/local/output/
AWS Lambda
Prerequisities:
Install the AWS Go SDK along with AWS Lambda Go.
Create a Lambda Function with a trigger to a specific bucket/directory.
Add 3 environment variables to your lambda function
imageDestinationPath - the path you want the resized image to be saved to.
imageName - full name of the image including its suffix (.jpg)
imageSrcPath - the source bucket/directory of the image.
Set your Lambda Handler to "main"
Setup a Role that has access to lambda, cloudwatchlogs and S3
How to run:
Navigate to the src/aws/
Run "GOOS=linux go build main.go" to ensure the go executable is compatible with the go runtime.
Run "zip function.zip main" to create the zip file with the go executable
Upload function.zip to AWS Lambda
File Structure
images
└─── test images
src
├── aws
│ └─── main.go (AWS implementation)
└── local
└─── main.go (local implementation)