Git Product home page Git Product logo

photo-resizer's Introduction

photo-resizer

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:

  1. Navigate to src/local/
  2. Create 2 directories named "input" and "output"
  3. Add jpg images you want to resize to "input" directory
  4. Run "go run main.go"
  5. 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:

  1. Navigate to the src/aws/
  2. Run "GOOS=linux go build main.go" to ensure the go executable is compatible with the go runtime.
  3. Run "zip function.zip main" to create the zip file with the go executable
  4. Upload function.zip to AWS Lambda

File Structure

images
 └─── test images
src
 ├── aws
 │     └─── main.go (AWS implementation)
 └── local
       └─── main.go (local implementation)

License

MIT

photo-resizer's People

Contributors

brianrclow avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.