Giter Club home page Giter Club logo

anwaltde's Introduction

Image Service App

The application was developed as part of selection process for Anwalt. The functionality that this application covers are resizing and cropping image which is present on the server.

# Prerequisites

  • docker
  • docker-compose (this comes with docker installation in most cases, but if you don't have it you can install it from here)
  • make (sudo apt-get install build-essential)

# Installation

Go to project directory and run:

via make

make

via docker-compose

docker-compose up -d

The application will be accessible on localhost port 8756

http://localhost:8756/

In case this port is being in use, change the port in docker-compose.yml

# Core

Router/Router.php

Each request goes thru this class and is being routed to corresponding controller and action. Routes are defined in $routes property

private $routes = [
    [
        'path' => '/',
        'controller' => HomeController::class,
        'action' => 'index',
        'method' => 'GET'
    ]
];
Controller/

Application endpoints

Class/

Entities such as Image class that is currently present in code.

Service/

Classes that hold the logic and manipulate entities and do the calculations.

# Endpoints

Without query parameters application will render cropped and resized image if they exist.

For manipulating the image query parameters need to be provided. Crop:

  • type: crop
  • width
  • height
  • x
  • y

Example: http://localhost:8756/?type=crop&x=20&y=200&width=200&height=400

Resize:

  • type: resize
  • width
  • height

Example: http://localhost:8756/?type=resize&width=200&height=400

# Tests

You can run test by executing:

# run tests inside docker
make test

or

# run test locally
make test-local

anwaltde's People

Contributors

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