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.
- 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)
Go to project directory and run:
make
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
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'
]
];
Application endpoints
Entities such as Image class that is currently present in code.
Classes that hold the logic and manipulate entities and do the calculations.
# [GET] http://localhost:8756/
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
You can run test by executing:
# run tests inside docker
make test
or
# run test locally
make test-local