2017 © Pedro PelĂĄez
 

project flyimg

Server image resizing and cropping on the fly base on ImageMagick+MozJPEG

image

flyimg/flyimg

Server image resizing and cropping on the fly base on ImageMagick+MozJPEG

  • Friday, June 22, 2018
  • by sadok-f
  • Repository
  • 20 Watchers
  • 490 Stars
  • 79 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 35 Forks
  • 11 Open issues
  • 27 Versions
  • 4 % Grown

The README.md

Flyimg

Flyimg
Official website »
GitHub · Bugs Report , (*1)

Backers on Open Collective Sponsors on Open Collective Build Status Codecov License Latest Stable Version] , (*2)

The Flyimg project is a Dockerized application that allows you to resize, crop, and compress images on the fly. One Docker container to build your own Cloudinary-like service., (*3)

By default, Flyimg generates the AVIF image format (when the browser supports it) which provides superior compression compared to other formats., (*4)

Additionally, Flyimg also generates the WebP format, along with the impressive MozJPEG compression algorithm to optimize images, other formats are supported also such as PNG and GIF., (*5)

Fetch an image from anywhere; resize, compress, cache and serve... and serve, and serve, and serve...

You pass the image URL and a set of keys with options, like size or compression. Flyimg will fetch the image, convert it, store it, cache it and serve it. The next time the request comes, it will serve the cached version., (*6)

<!-- https://mudawn.com/assets/butterfly-3000.jpg -->
<img
  src="https://demo.flyimg.io/upload/w_300,q_90/https://mudawn.com/assets/butterfly-3000.jpg"
/>

Flyimg-demo, (*7)

Demo

Check out our demo page where you can test and review Flying's features:, (*8)

https://demo.flyimg.io/, (*9)

Documentation

Documentation available here: https://flyimg.io, (*10)

Cloud Run Button

Flyimg can be deployed to GCP as a serverless container in one click with Cloud Run Button:, (*11)

Run on Google Cloud, (*12)

Requirements

You will need to have Docker on your machine. Optionally you can use Docker machine to create a virtual environment. We have tested on Mac, Windows and Ubuntu., (*13)

Usage

Pull the docker image, (*14)

docker pull flyimg/flyimg

Start the container, (*15)

docker run -itd -p 8080:80 flyimg/flyimg

To use custom parameters, make a copy of parameters.yml to your current directory. Update to suit your needs and run the command with volume parameter to replace the original parameters file., (*16)

docker run -itd -p 8080:80 -v $(pwd)/parameters.yml:/var/www/html/config/parameters.yml flyimg/flyimg

Build locally [Development Mode]

git clone https://github.com/flyimg/flyimg.git

CD into the folder and to build the docker image by running:, (*17)

docker build -t flyimg .

This will download and build the main image, It will take a few minutes. If you get some sort of error related to files not found by apt-get or similar, try this same command again., (*18)

IMPORTANT! If you cloned the project, only for the first time, you need to run composer install inside the container:, (*19)

docker exec -it flyimg composer install

Again, it will take a few minutes to download the dependencies. Same as before, if you get some errors you should try running composer install again., (*20)

Then run the container:, (*21)

docker run -itd -p 8080:80 -v $(pwd):/var/www/html --name flyimg flyimg

For Fish shell users:, (*22)

docker run -itd -p 8080:80 -v $PWD:/var/www/html --name flyimg flyimg

The above command will make the Dockerfile run s6-overlay command which launches 2 services: nginx and php-fpm and starts listening on port 80 on the container and port 8080 on the host., (*23)

Testing Flyimg service

You can navigate to your machine's IP in port 8080 (ex: http://127.0.0.1:8080/ ) ; you should get a message saying: Hello from Flyimg! and a small homepage of Flyimg already working. If you get any errors at this stage it's most likely that composer has not finished installing or skipped something., (*24)

You can test your image resizing service by navigating to: http://127.0.0.1:8080/upload/w_130,h_113,q_90/https://mudawn.com/assets/butterfly-3000.jpg, (*25)

It's working!, (*26)

This is fetching an image from Mozilla, resizing it, saving it and serving it., (*27)

How to transform images

You go to your server URLhttp://imgs.kitty.com and append /upload/; after that you can pass these options below, followed by an underscore and a value w_250,q_50 Options are separated by coma (configurable to other separator)., (*28)

After the options put the source of your image, it can be relative to your server or absolute: /https://my.storage.io/imgs/pretty-kitten.jpg, (*29)

So to get a pretty kitten at 250 pixels wide, with 50% compression, you would write. <img src="http://imgs.kitty.com/upload/w_250,q_50/https://my.storage.io/imgs/pretty-kitten.jpg">, (*30)


Demo Application running

https://demo.flyimg.io, (*31)

https://demo.flyimg.io/upload/w_300,h_250,c_1,o_jpg/https://mudawn.com/assets/butterfly-3000.jpg, (*32)

resize-test, (*33)

Star History

Star History Chart , (*34)

Community

Adopters

See the ADOPTERS.md file for a list of companies / organisations that are using Flyimg., (*35)

Supporters

A special thanks to JetBrains for supporting our project with their open source license program., (*36)

Jetbrains, (*37)

Contributors

This project exists thanks to all the people who contributed to it. , (*38)

Backers & Sponsors

Support us with a monthly donation and help us continue our activities.[opencollective.com], (*39)

, (*40)

License

The MIT License (MIT). Please see License File for more information., (*41)

Enjoy your Flyimaging!, (*42)

The Versions

03/03 2017

dev-phontomjs-php

dev-phontomjs-php https://github.com/flyimg/flyimg

A Dockerized Microservice, a PHP application to resize and crop images on the fly. Get optimised images with MozJPEG, WebP or PNG using ImageMagick. Includes face detection, cropping, face blurring, image rotation and many other options. Abstract storage based on FlySystem in order to store images on any provider (local, AWS S3...).

  Sources   Download

MIT

The Requires

 

The Development Requires

docker image resize crop imagemagick flysystem mozjpeg