1. Go to this page and download the library: Download imagecow/imagecow 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/ */
use Imagecow\Image;
//Using Imagick:
$image = Image::fromFile('my-image.jpg', Image::LIB_IMAGICK);
//Detect the available library automatically
//(in order of preference: Imagick, Gd)
$image = Image::fromFile('my-image.jpg');
//Create an instance from a string
$image = Image::fromString(file_get_contents('my-image.jpg'));
//Assuming the original image is 1000x500
$image->resize(200); // change to 200x100
$image->resize(0, 200); // change to 400x200
$image->resize(200, 300); // change to 200x100
$image->resize(2000, 2000); // keeps 1000x500
$image->crop(200, 300); // crops to 200x300px
$image->crop(200, 300, 'left', 'top'); // crops to 200x300px from left and top
$image->crop(200, 300, 20, '50%'); // crops to 200x300px from 20px left and 50% top
$image->crop('50%', '50%'); // crops to half size
$image->crop(500, 200, Image::CROP_ENTROPY); // crops to 500x200 using the Entropy method to calculate the center point
$image->crop(500, 200, Image::CROP_BALANCED); // The same as above but using the Balanced method
$image->resizeCrop(200, 300); //Resizes and crops to 200x300px.
$image->resizeCrop('50%', 300); //Resizes and crops to half width and 300px height
$image->resizeCrop(200, 300, 'left', '100%'); //Resizes and crops to 200x300px from left and bottom
$image->resizeCrop(200, 300, Image::CROP_BALANCED); //Resizes and crops to 200x300px using the CROP_BALANCED method
$image->rotate(90); // rotates the image 90 degrees
$image->show(); // you should see this image in your browser
echo '<img src="' . $image->base64() . '">';
$image->transform('resize,200,50%|format,png|crop,100,100,CROP_ENTROPY');
//This is the same than:
$image
->resize(200, '50%')
->format('png')
->crop(100, 100, Image::CROP_ENTROPY);
use Imagecow\Image;
$file = __DIR__.'/'.$_GET['file'];
$transform = isset($_GET['transform']) ? $_GET['transform'] : null;
//Create the image instance
$image = Image::fromFile($file);
//Set the client hints
$image->setClientHints([
'dpr' => isset($_SERVER['HTTP_DPR']) ? $_SERVER['HTTP_DPR'] : null,
'width' => isset($_SERVER['HTTP_WIDTH']) ? $_SERVER['HTTP_WIDTH'] : null,
'viewport-width' => isset($_SERVER['HTTP_VIEWPORT_WIDTH']) ? $_SERVER['HTTP_VIEWPORT_WIDTH'] : null,
]);
//Transform the image and display the result:
$image->transform($transform)->show();
use Imagecow\Utils\IconExtractor;
$icon = new IconExtractor('favicon.ico');
//Gets the better image from the icon (quality = color_depth + (width * height))
$image = $icon->getBetterQuality();
//Do imagecow stuff
$image->resize(100)->save('my-image.png');
use Imagecow\Utils\SvgExtractor;
$svg = new SvgExtractor('image.svg');
//Gets the image
$image = $svg->get();
//Now you can execute the imagecow methods:
$image->resize(200)->format('jpg')->save('image.jpg');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.