Provides access to Cloudflare Images API for Laravel projects

Overview

Cloudflare Images

Provides access to Cloudflare Images API for Laravel projects

Stable Version Unstable Version Total Downloads License

Table of contents

Installation

To get the latest version of Laravel CloudflareImages, simply require the project using Composer:

$ composer require dedmytro/laravel-cloudflare-images

Or manually update require block of composer.json and run composer update.

{
    "require": {
        "dedmytro/laravel-cloudflare-images": "^0.1"
    }
}

Configuration

Add two environment variables to your .env file:

CLOUDFLARE_IMAGES_ACCOUNT='your-account-id'
CLOUDFLARE_IMAGES_KEY='your-api-key'

or publish config and set up vars there

return [
    'account'=> env('CLOUDFLARE_IMAGES_ACCOUNT'),
    'key'=> env('CLOUDFLARE_IMAGES_KEY'),
];

Using

Upload

Call upload() method and pass file as local file path or UploadedFile instance. As a result of upload you'll get DetailsResponse instance with uploaded image details, so you can save it locally.

use DeDmytro\CloudflareImages\Facades\CloudflareImages;
use DeDmytro\CloudflareImages\Http\Responses\DetailsResponse;
use DeDmytro\CloudflareImages\Http\Entities\Image;

/* @var $file \Illuminate\Http\UploadedFile|string */

/* @var $response DetailsResponse*/
$response = CloudflareImages::api()->upload($file)

/* @var $image Image*/
$image = $response->result

$image->id;
$image->filename;
$image->variants->thumbnail;
$image->variants->original;

List

To list existing images you should use list() method which also has pagination and accept $page and $perPage arguments.

use DeDmytro\CloudflareImages\Facades\CloudflareImages;

/* @var $response ListResponse*/
$response = CloudflareImages::api()->list()
//OR
$response = CloudflareImages::api()->list($page, $perPage)

foreach($response->result as $image){
    $image->id;
    $image->filename;
    $image->variants->thumbnail;
    $image->variants->original;
}

Details

To get existing image details you should use get($id) method where $id is image identifier you received when you list or upload the image.

use DeDmytro\CloudflareImages\Facades\CloudflareImages;

$response = CloudflareImages::api()->get($id)

$image = $response->result;
$image->id;
$image->filename;
$image->variants->thumbnail;
$image->variants->original;

Delete

To delete existing image you should use delete($id) method where $id is image identifier you received when you list or upload the image.

use DeDmytro\CloudflareImages\Facades\CloudflareImages;

$response = CloudflareImages::api()->delete($id)
$response->success
You might also like...
ViMbAdmin project provides a web based virtual mailbox administration system to allow mail administrators to easily manage domains, mailboxes and aliases.

ViMbAdmin project (vim-be-admin) provides a web based virtual mailbox administration system to allow mail administrators to easily manage domains, mailboxes and aliases.

QuidPHP/Core is a PHP library that provides an extendable platform to create dynamic applications

QuidPHP/Core About QuidPHP/Core is a PHP library that provides an extendable platform to create dynamic applications. It is part of the QuidPHP packag

Laravel wrapper for the Fathom Analytics API
Laravel wrapper for the Fathom Analytics API

Please note: This package is still a work in progress and the Fathom API is also only in early access. Do not use this package in your production envi

Translate laravel resource, vendor, folder or file from google translation without requiring any api information
Translate laravel resource, vendor, folder or file from google translation without requiring any api information

⚡ ⚡ ⚡ Laravel Go Translate Translate laravel resource, vendor, folder or file from google translation without requiring any api information. Table of

Facebook & Instagram Ads API for Laravel
Facebook & Instagram Ads API for Laravel

Laravel Facebook Ads Get ads infos (campaigns, ads, insights, etc...) from Facebook & Instagram Ads API Supported Facebook API version: = v3.0 Instal

Faculty Management System (FMS) Built with Laravel 9 in Back-end and React , Redux in Front-end API's

Final Project Faculty Management System (FMS) as final project for faculty of Copmuter Science, Kandahar University, 2021 Faculty Management System (F

🌶🥗🧀🍉 Brazilian Table of Food Composition made by IBGE - Laravel 9 REST API

About API of the 2008-2009 Family Budget Survey: tables of nutritional composition of foods consumed in Brazil / IBGE, Coordination of Work and Income

¡BACKEND OVER APP! API REST IMPLEMENTANDO CONCEPTOS DE ARQUITECTURA HEXAGONAL, DDD, TDD Y SOLID. HECHO EN LARAVEL & PHP
¡BACKEND OVER APP! API REST IMPLEMENTANDO CONCEPTOS DE ARQUITECTURA HEXAGONAL, DDD, TDD Y SOLID. HECHO EN LARAVEL & PHP

¡BACKEND OVER APP! API REST IMPLEMENTANDO CONCEPTOS DE ARQUITECTURA HEXAGONAL, DDD, TDD Y SOLID. HECHO EN LARAVEL & PHP

The API & platform builder, build your apps 10x faster even more, it's open source & 100% free !
The API & platform builder, build your apps 10x faster even more, it's open source & 100% free !

The API & platform builder, build your apps 10x faster, even more. It's open source & 100% free ! Try live demo Why badaso ? 100% FREE - No need for e

Comments
  • TypeError exception in BaseResponse.php

    TypeError exception in BaseResponse.php

    • Laravel Cloudflare Images version: 0.1.6
    • PHP Version: 8.0.10
    • Laravel/Lumen Framework Version: 8.75.0
    • Database Driver & Version: MySQL 8.0.26

    Description:

    Hi! Thanks for creating this package. When just getting started, I'm hitting an exception when trying to do basic things like list existing files:

    [2021-12-23 19:08:53] local.ERROR: DeDmytro\CloudflareImages\Http\Responses\ListResponse::__construct(): Argument #1 ($result) must be of type array, null given, called in /Users/chris/develop/myproject/vendor/dedmytro/laravel-cloudflare-images/src/Http/Responses/BaseResponse.php on line 57 {"exception":"[object] (TypeError(code: 0): DeDmytro\\CloudflareImages\\Http\\Responses\\ListResponse::__construct(): Argument #1 ($result) must be of type array, null given, called in /Users/chris/develop/myproject/vendor/dedmytro/laravel-cloudflare-images/src/Http/Responses/BaseResponse.php on line 57 at /Users/chris/develop/myproject/vendor/dedmytro/laravel-cloudflare-images/src/Http/Responses/ListResponse.php:27)
    

    I'm wondering if you have any guidance. Thank you.

    Steps To Reproduce:

    CloudflareApi::images()->list()

    I confirmed that these vars are set in .env:

    CLOUDFLARE_IMAGES_ACCOUNT
    CLOUDFLARE_IMAGES_KEY
    CLOUDFLARE_IMAGES_DELIVERY_URL
    CLOUDFLARE_IMAGES_DEFAULT_VARIATION
    
    opened by ChrisHardie 3
  • Failed to open stream: No such file or directory

    Failed to open stream: No such file or directory

    • Laravel Model Related Fields Version: #.#.#
    • PHP Version: #.#.#
    • Laravel/Lumen Framework Version: #.#.#
    • Database Driver & Version:

    Uploading images with CloudflareApi::images()->upload() results to Failed to open stream: No such file or directory

    Steps To Reproduce:

    Execution result:

    Show result
    // paste result here
    
    opened by Boomchart 1
  • Guzzle 7 Support

    Guzzle 7 Support

    When running composer install i'm getting the following error:

    dedmytro/laravel-cloudflare-images 0.1.5 requires guzzlehttp/guzzle ^6.2.1 -> found guzzlehttp/guzzle[6.2.1, ..., 6.5.x-dev] but the package is fixed to 7.3.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.

    Is it compatible with Guzzle 7?

    opened by robjbrain 1
Releases(0.1.9)
Owner
Dmytro
Dmytro
Uploader is a set of small classes for sending images, files, and media received by a form of your application

Uploader is a set of small classes for sending images, files, and media received by a form of your application. The Uploader handles, validates and sends the files to your server. Image class can still handle sizes with the gd library.

null 5 Dec 22, 2022
BicBucStriim streams books, digital books. It fills a gap in the functionality of current NAS devices that provide access to music, videos and photos

BicBucStriim streams books, digital books. It fills a gap in the functionality of current NAS devices that provide access to music, videos and photos -- but not books. BicBucStriim fills this gap and provides web-based access to your e-book collection.

Rainer Volz 392 Dec 31, 2022
Joyce 🦊 - Panel Remote Access Android, Windows and Linux

Joyce is an exploiting tool (botnet) which compiles a malware with famous payload, and then the compiled maware can be executed on Linux , Windows and Android. Joyce Provides An Easy way to create Backdoors and Payload which can bypass most anti-virus.

AeX03 8 Nov 1, 2022
A slim, lean forum package designed for quick and easy integration in Laravel projects

Complete documentation is available on teamteatime.net. Installation Requires Laravel 6+ and PHP 7.4+. Step 1: Install the package Install the package

TeamTeaTime 486 Dec 31, 2022
YouTubeClone - Web Projects Build By Laravel Framework v8 & LiveWire it's Small project to upload video Like Youtube

YouTubeClone YouTubeClone - Web Projects Build By Laravel Framework & LiveWire it's Small project to upload video Like Youtube Use Laravel v8.80.0 Ima

Hesham Adel 1 Jan 24, 2022
AdoteUm.Dev has the proposal to connect people who are looking for developers for their projects

AdoteUm.Dev has the proposal to connect people who are looking for developers for their projects. AdoteUmDev is a web application, developed in PHP language and the Laravel Framework.

Beer And Code 101 Oct 19, 2022
Sign URLs with expiration date to transfer data between projects.

SafeLink Framework-agnostic, lightweight URL signer. You can use SafeLink to transfer data between projects. Sign the url in project 1: use Alfatron\S

Ozan Hazer 4 Feb 2, 2022
ATOS is a locally hosted application that allows you to easily manage clients/projects, generate invoices against backlogs, and estimate taxes.

Built by freelancer ??‍♂️, for freelancer ?? ?? ???? - ATOS is a locally hosted application that allows you to easily manage clients/projects, generate invoices against backlogs, and estimate taxes.

Jon Belelieu 33 Dec 27, 2022
Provides an API wrapper for interacting with remote CiviCRM instances via APIv4.

civicrm-api is a Composer package that allows developers to interact with a CiviCRM instance using the REST API v4 functionality within CiviCRM.

Circle Interactive 1 Apr 4, 2022
DooTask is a lightweight open source online project task management tool that provides various document collaboration tools, online mind mapping, online flowcharting, project management, task distribution, instant IM, file management and other tools.

DooTask is a lightweight open source online project task management tool that provides various document collaboration tools, online mind mapping, online flowcharting, project management, task distribution, instant IM, file management and other tools.

kuaifan 3k Jan 5, 2023