Code Monkey home page Code Monkey logo

imageresizeproxy's Introduction

ImageResizeProxy

This project is a demo that shows how to use this Azure Function (3.1) to dynamically resize images that are held in an Azure Storage container.

There are several query string switches that can be used. Here are all of them currently

https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?size=small
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?size=medium
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?size=hero
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?w=200
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?h=300
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?w=400&h=300
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?output=png
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?output=gif
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?mode=stretch
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?mode=boxpad
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?mode=pad
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?mode=max
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?mode=min
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?mode=crop
// all together
https://function-endpoint.azurewebsites.net/api/resizeimage/someimage.jpg?w=400&h=300&output=png&mode=stretch

To run locally, rename the example.local.settings.json file to local.settings.json and update the settings to fit your environment.

To run in Azure, simply publish the project to a new Azure Function and create the following Application Settings in the Azure Portal:

  1. AzureContainer - name of the container
  2. ImageResizer:HeroSize - 1440x620
  3. ImageResizer:MediumSize - 400x400
  4. ImageResizer:SmallSize - 200x200
  5. ClientCache:MaxAge - 30.00:00:00

And add in a Connection String called "AzureStorage" that cooresponds with your storage account.

Happy Resizing.

imageresizeproxy's People

Contributors

redapollos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

imageresizeproxy's Issues

Cache headers are set too early.

The caching headers are set too early. These needs to be set if the result is a Successful. Currently BadRequest and NotFound results are cached and further honored at CDN and browser level.

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.