Coder Social home page Coder Social logo

sunbox / resizingservice Goto Github PK

View Code? Open in Web Editor NEW

This project forked from codeprincess/resizingservice

0.0 2.0 0.0 25 KB

A very basic version of an image resizing service implemented just on the basis of Azure Functions

License: MIT License

C# 100.00%

resizingservice's Introduction

license Azure Functions Azure CLI compatible Azure PowerShell compatible

A Resizing Service on Steroi... - Azure Functions!

This repository gives you everything to deploy your own (basic) image resizing service based on Azure Functions and Azure Blob Storage.

Deployment

You have three options how you want to deploy the service. The easiest way is to press the button above. The other two options need a bit more knowledge of Azure CLI or PowerShell - so chose the weapon you feel most comfortable with. What happens during the deployment is shown by this neat illustration :) ResizingService deployment

Option 1: The easy cake

Just click the "Deploy to Azure" button.

Option 2: Use Azure CLI to deploy the ARM template

If you haven't already installed the Azure CLI, you download the installable here: Azure CLI download

  1. Chose a name for your service Change "storageAccountName" in the parameter.json file to a value that fits for you. This will be the name for your services and must be unique. If the deployment fails, the error message might indicate that your chosen name was not unique.

  2. Open a terminal or command line

  3. Login to Azure Follow the install instructions

    azure login

  4. Create a new Resource Group Be aware that this name needs to be unique within your subscription.

    azure group create -n ResizingFunctionGroup -l "West Europe"

  5. Deploy the ARM template to the resource group

    azure group deployment create -f azuredeploy.json -e parameters.json -g ResizingFunctionGroup -n MyARMDeployment

A detailed how-to can be find in this blog post with a lot of descriptive screenshots of the process Deployment of a mock server using Azure Functions

###Option 3: Use Powershell to deploy the ARM template

  1. Login to Azure

    Login-AzureRmAccount Select-AzureRmSubscription -SubscriptionID "your-subscription-id"

  2. Create a new Resource Group

    New-AzureRmResourceGroup -Name ResizingFunctionGroup -Location "West Europe"

  3. Deploy ARM to Resource Group

    New-AzureRmResourceGroupDeployment -ResourceGroupName ResizingFunctionGroup -TemplateFile "azuredeploy.json" -TemplateParameterFile "parameters.json"

##Usage After the deployment you will have an HTTP POST endpoint saveOriginal. Just add the URL parameter imgName and tell the service how your image shall be named. Then attach the file itself and post everything into the interwebsz :)

Your URL will look like this: https://theNameOfYourApp.azurewebsites.net/api/saveOriginal

  • Request - URL parameters
    • code = your code listed at the function as a very basic way of authentication
    • imgName = the name of the file - and all its resizings - within the service
  • Request - File attachment
    • attach your image to the POST request
  • Response
    • [string, string] - a dictionary of URLs in the JSON format which contain all the generated resized versions of your uploaded image with the size as the key

Response example

{
 "original":"https://thumbfuncstorage.blob.core.windows.net/originals/mario/mario.jpeg",
 "200":"https://thumbfuncstorage.blob.core.windows.net/sized/200/mario/mario.jpeg",
 "100":"https://thumbfuncstorage.blob.core.windows.net/sized/100/mario/mario.jpeg",
 "80":"https://thumbfuncstorage.blob.core.windows.net/sized/80/mario/mario.jpeg",
 "64":"https://thumbfuncstorage.blob.core.windows.net/sized/64/mario/mario.jpeg",
 "48":"https://thumbfuncstorage.blob.core.windows.net/sized/48/mario/mario.jpeg",
 "24":"https://thumbfuncstorage.blob.core.windows.net/sized/24/mario/mario.jpeg"
 }

In the "background" the second deployed function will be called as soon as the blob service saved the original - and then the resized images are generated.

##WOW, a wild resizing service appeared

So this is it! Just those few steps and you have a ready to go resizing service! Nice one!

Have fun and share your feedback with me :)

resizingservice's People

Contributors

codeprincess avatar juliajauss avatar

Watchers

 avatar  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.