PHP code example of marchiorineto / cloudflare-images-laravel

1. Go to this page and download the library: Download marchiorineto/cloudflare-images-laravel 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/ */

    

marchiorineto / cloudflare-images-laravel example snippets


use MarchioriNeto\CloudflareImagesLaravel\CloudflareImages;
use MarchioriNeto\CloudflareImagesLaravel\ImageVariant;

$variant = new ImageVariant('tiny');
$variant->fit('contain')
    ->width(50)
	->height(50)
	->metaData('keep');
	
$cfImages = new CloudflareImages();
$cfImages->createVariant($variant);

use MarchioriNeto\CloudflareImagesLaravel\CloudflareImages;

$cfImages = new CloudflareImages();
// Pass either a file path or a file resource as the first parameter.
// If you want the image to be private (always 

use MarchioriNeto\CloudflareImagesLaravel\CloudflareImages;

$cfImages = new CloudflareImages();
$cfImages->getSignedUrl('image-uuid', new DateTime('+1 day'));

use MarchioriNeto\CloudflareImagesLaravel\CloudflareImages;

$cfImages = new CloudflareImages('CLOUDFLARE_IMAGES_ACCOUNT', 'CLOUDFLARE_API_TOKEN', 'CLOUDFLARE_IMAGES_KEY', 'CLOUDFLARE_IMAGES_DELIVERY_URL');