PHP code example of alexbuckham / cloudflare-images-laravel

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

    

alexbuckham / cloudflare-images-laravel example snippets


use AlexBuckham\CloudflareImagesLaravel\CloudflareImages;
use AlexBuckham\CloudflareImagesLaravel\ImageVariant;

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

use AlexBuckham\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 AlexBuckham\CloudflareImagesLaravel\CloudflareImages;

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

use AlexBuckham\CloudflareImagesLaravel\CloudflareImages;

$cfImages = new CloudflareImages('CF_IMAGES_ACCOUNT_ID', 'CF_IMAGES_CF_IMAGES_TOKEN', 'CF_IMAGES_KEY', 'CF_IMAGES_DELIVERY_URL');