PHP code example of jcupitt / vips

1. Go to this page and download the library: Download jcupitt/vips library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jcupitt / vips example snippets


#!/usr/bin/env php

st thumbnail generator
$image = Vips\Image::thumbnail('somefile.jpg', 128);
$image->writeToFile('tiny.jpg');

// load an image, get fields, process, save
$image = Vips\Image::newFromFile($argv[1]);
echo "width = $image->width\n";
$image = $image->invert();
$image->writeToFile($argv[2]);

$new_image = $image->more(12)->ifthenelse(255, $image);

$image = $image->add(2);

$image = $image->add([1, 2, 3]);

$image = $image->add($image2);

$image = $image->add([[1, 2, 3], [4, 5, 6]]);

$image->writeToFile("fred.jpg", ["Q" => 90]);