bencagri/photon

There is no license information available for the latest version (1.0.2) of this package.

1.0.2 2018-02-09 13:20 UTC

This package is auto-updated.

Last update: 2024-04-28 22:43:11 UTC


README

main.jpg

JETPACK PHOTON WRAPPER

What is Photon?

Photon is an image acceleration and modification service for Jetpack-connected WordPress sites. Converted images are cached automatically and served from the WordPress.com CDN. Images can be cropped, resized, and filtered by using a simple API controlled by GET query arguments. When Photon is enabled in Jetpack, images are updated on the fly.

Why wrapper?

This wrapper allows you to use photon on your host (servers) and its fully object oriented.

Installation

$ composer require bencagri/photon

Notice: to use it on your servers, you need to install gmagick package

Sample implementation.

<?php

use Photon\Wrapper\Generate;
use Photon\Wrapper\Effect\Height;
use Photon\Wrapper\Effect\Width;
use Photon\Wrapper\Effects;

require 'vendor/autoload.php';

// Set your effects
$effects = new Effects(
    new Width(500),
    new Height(500)
);

$imageUrl = 'http://sample-site.com/sample-image.jpg';

//Generate image with your effects
$process = new Generate($imageUrl,$effects);
$process->process();

You can combine multiple effects also.

<?php
use Photon\Wrapper\Effect\Crop;
use Photon\Wrapper\Effect\Filter;
use Photon\Wrapper\Effects;

$crop = new Crop(500,250,330,300);

$effects = new Effects(
    $crop,
    new Filter('emboss')
);

Full documentation of all effects.

Licence

  • The Photon Wrapper is open-sourced software licensed under the MIT license.
  • The Photon is open-sourced software licenced under GNU GENERaL PUBLIC LICENCE