Image management on Cloudflare

Overview

#Cloudflare image management sample

Getting Started

This project contains sample code for the Cloudflare images API.

Code is available for:

  1. Uploading an image
  2. Checking if an image exists
  3. Deleting an image on Cloudflare
  4. Generation of a direct upload URL (for use in forms)

This project uses Spring Boot, Thymeleaf and Cloudflare APIs

Step 1 (Setup paid account with Cloudflare)

  1. Create an account with Cloudflare.

Step 2 (Application configuration)

Cloudflare configuration in application.properties

Set the following values in application.properties, to try out this application:
These values are available from the Cloudflare portal (https://dash.cloudflare.com/<YOUR_ACCOUNT_ID>/images/variants)
cloudflare.account-id=YOUR_ACCOUNT_ID
cloudflare.image-delivery-url=https://imagedelivery.net/STRING_FROM_ABOVE_URL/

#[Get your API token here](https://dash.cloudflare.com/profile/api-tokens)
cloudflare.bearer-token=BEARER_TOKEN

cloudflare.image.direct-upload-request-url=https://api.cloudflare.com/client/v4/accounts/${cloudflare.account-id}/images/v1/direct_upload
cloudflare.image.delete-url.prefix=https://api.cloudflare.com/client/v4/accounts/${cloudflare.account-id}/images/v1/
cloudflare.image.upload-url=https://api.cloudflare.com/client/v4/accounts/${cloudflare.account-id}/images/v1
cloudflare.image.details-url.prefix=https://api.cloudflare.com/client/v4/accounts/${cloudflare.account-id}/images/v1/

Application configuration in application.properties

This is a directory on the application server, where the files will be uploaded to. Files shall be uploaded from this folder onto Cloudflare. Ensure that the account has read and write permissions to these folders.

application.images.directory-root=C:\\Temp\\Downloads
application.image-to-upload=C:\\Temp\\Downloads\\images.png

Place an image in the above-mentioned folder, to test for uploads.

private var pathToImageFile : String = "C:\\Temp\\Downloads\\image.jpg"

The above file is uploaded to Cloudflare directly using the ImageService service. The existence of the image is verified and the image is deleted. The code for this is available in Initializer class of CloudflarephotosApplication.kt

Try it out

  1. Build the project
  2. Launch the application at https://localhost:8080
  3. Upload a file
    • The file is uploaded to the directory specified by application.images.directory-root
    • The file is then uploaded to Cloudflare
  4. Navigate to https://dash.cloudflare.com/<YOUR_ACCOUNT_ID>/images/images to view the uploaded images

Reference Documentation

For further reference, please consider the following sections:

Guides

The following guides illustrate how to use some features concretely:

Additional Links

These additional references should also help you:

You might also like...
An image resizing library for Android
An image resizing library for Android

Resizer Inspired by zetbaitsu's Compressor, Resizer is a lightweight and easy-to-use Android library for image scaling. It allows you to resize an ima

✔️ Hide a secret message in an image
✔️ Hide a secret message in an image

Image Steganography Steganography is the process of hiding a secret message within a larger one in such a way that someone cannot know the presence or

Auto Scrolling Image Pager with Pager Indicator and Text
Auto Scrolling Image Pager with Pager Indicator and Text

AutoImageFlipper Auto Scrolling Image Pager with Pager Indicator and Text Note: It works only on Apps which are using AndroidX dependencies, if you're

Simple android image popup Library
Simple android image popup Library

Android Image Popup Show image as a popup on a click event or any event. Simply set the image as drawable and thats it!!!. And also you can set width,

Library to save image locally and shows options to open and share !

Image Save and Share Library to save image locally and shows options to open and share ! Download Demo APK from HERE Kindly use the following links to

Image loading library for Android

Image Loader Image loader library for Android. Deprecated. See Glide. Features Image transformations Automatic memory and storage caching Ability to l

RoundedImageView-Library 0.9 0.0 Java To set single or multiple corners on Image Views.
RoundedImageView-Library 0.9 0.0 Java To set single or multiple corners on Image Views.

RoundedImageView-Library Rounded ImageView Android Library, to set single or multiple corners on imageview. Screenshot Usage Step 1. Add the JitPack r

A library for image manipulation with power of renderScript which is faster than other ordinary solutions.
A library for image manipulation with power of renderScript which is faster than other ordinary solutions.

Pixl is a library for image manipulation with power of renderScript which is faster than other ordinary solutions, currently it includes three basic scripts, brightness, contrast, saturation.

Phimp.me Android Phimp.me is an Android image editor app
Phimp.me Android Phimp.me is an Android image editor app

Phimp.me Android Phimp.me is an Android image editor app that aims to replace proprietary photographing and image apps on smart phones. It offers feat

Owner
null
This is an Image slider with swipes, Here we used Volley to Image load URL's from JSON! Here we make it very easy way to load images from Internet and We customized the description font style(OpenSans).

ImageSliderWithSwipes This is an Image slider with swipes, Here we used Volley to load URL's from JSON! Here we make it very easy way to load images f

Prabhakar Thota 44 May 31, 2021
Add curve at bottom of image views and relative layouts.

Crescento Android library that adds a curve at the below of image views and relative layouts. CrescentoImageView and CrescentoContainer are the image

Shivam Satija 1.3k Nov 18, 2022
some android image filters

android-image-filter some android image filters in some filter, I use NDK to implement to make it more efficient Setup Install Android NDK and properl

RagnarokStack 643 Dec 27, 2022
An android image compression library.

Compressor Compressor is a lightweight and powerful android image compression library. Compressor will allow you to compress large photos into smaller

Zetra 6.7k Dec 31, 2022
Android widget for cropping and rotating an image.

Cropper The Cropper is an image cropping tool. It provides a way to set an image in XML and programmatically, and displays a resizable crop window on

Edmodo 2.9k Nov 14, 2022
A simple image cropping library for Android.

SimpleCropView The SimpleCropView is an image cropping library for Android. It simplifies your code for cropping image and provides an easily customiz

Issei Aoki 2.5k Dec 28, 2022
Customizable Android full screen image viewer for Fresco library supporting "pinch to zoom" and "swipe to dismiss" gestures. Made by Stfalcon

This project is no longer supported. If you're able to switch from Fresco to any other library that works with the Android's ImageView, please migrate

Stfalcon LLC 1.8k Dec 19, 2022
Add curve at bottom of image views and relative layouts.

Crescento Android library that adds a curve at the below of image views and relative layouts. CrescentoImageView and CrescentoContainer are the image

Shivam Satija 1.3k Mar 24, 2021
Dali is an image blur library for Android. It contains several modules for static blurring, live blurring and animations.

Dali Dali is an image blur library for Android. It is easy to use, fast and extensible. Dali contains several modules for either static blurring, live

Patrick Favre-Bulle 1k Dec 1, 2022
A small customizable library useful to handle an gallery image pick action built-in your app. :sunrise_over_mountains::stars:

Louvre A small customizable image picker. Useful to handle an gallery image pick action built-in your app. *Images from Google Image Search Installati

André Mion 640 Nov 19, 2022