Giter VIP home page Giter VIP logo

fourcorners.js's Introduction

fourcorners.js

The Four Corners Project allows specific information to be embedded in each of the photograph’s four corners, where it is available for an interested reader to explore. This increased contextualization strengthens both the authorship of the photographer and the credibility of the image.

fourcorners.js is an open source JavaScript library that augments your embedded images with the interactive "four corners" and corresponding contextual data and media.

For inquiries about usage or development contribution, please email [email protected].

Setup

How to initialize an embed

new FourCorners(selector, options, provenance);

Default JSON embed

If you are embedding using HTML generated from the Four Corners Project's "Create your own" page you can ignore the provenance argument. Instead, your HTML will include your contextual data in a JSON object wrapped in a <script> tag.

new FourCorners(selector, options);

C2PA embed

If you are using an image file injected with the C2PA and Four Corners metadata, you must first extract the metadata from the image file and then pass as the provenance argument.

Add the following in your <head> tag:

<script type="module">
import { ContentAuth } from "https://cdn.jsdelivr.net/npm/@contentauth/[email protected]/dist/cai-sdk.esm.min.js";
import "https://cdn.jsdelivr.net/npm/@contentauth/[email protected]/dist/index.min.js";
var wasmSrc = "https://cdn.jsdelivr.net/npm/@contentauth/[email protected]/dist/assets/wasm/toolkit_bg.wasm";
var workerSrc = "https://cdn.jsdelivr.net/npm/@contentauth/[email protected]/dist/cai-sdk.worker.min.js";
var sdk = new ContentAuth({wasmSrc, workerSrc});
var provenance = await sdk.processImage(imgSrc);
await new FourCorners(selector, options, provenance);
</script>

Basic examples

Initialize with string selector

var fc_image = new FourCorners("img.fc-image");

Initialize with DOM element

var elem = document.querySelector("img.fc-image");
var fc_image = new FourCorners(elem);

Initialize with options

var fc_image = new FourCorners(elem, {
	caption: true,
	credit: true,
	logo: true,
	dark: true
});

Options

Name Type Default Description
caption boolean false Decides if the caption shows under the embed*
credit boolean false Decides if the credits show under the embed*
logo boolean false Decides if a hyperlinked Four Corners Project logo shows under the embed
dark boolean false Decides if the embed UI should be in dark mode

*These fields will always show in the Authorship panel regardless of these settings

fourcorners.js's People

Contributors

coreytegeler avatar makew0rld avatar yurkowashere avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.