Download the PHP package gbv/image-attribution without Composer

On this page you can find all versions of the php package gbv/image-attribution. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package image-attribution

image-attribution

Latest Stable Version

Build Status

This PHP library provides a method to retrieve information required for proper attribution of images from Wikimedia Commons.

Motivation

Wikimedia Commons contains images and other freely usable media files. Some files can be used without any conditions (public domain), others are licensed under an open content license. Depending on the particular license one has to give proper credit to the original author and/or name the specific license. Wikimedia Commons includes guidelines how to give proper credit but there is no easy way to look up attribution requirements for a given image in machine-readable format.

There is a method to retrieve some license information via Wikimedia Commons API, but the API is difficult to find and query, its return format is too verbose, and the response is not usable without further processing. For instance licenses are spelled in several different ways ("CC-BY-SA-3.0", "CC BY-SA 3.0"...) and field values may contain HTML tags.

Requirements

Requires PHP 5.6 or above and allow_url_fopen enabled.

Installation

Use composer:

$ composer require gbv/image-attribution

or just copy files src/image-attribution.php and src/identify-open-content-license.php by hand.

Usage

Use autoload:

require 'vendor/autoload.php';

or include the library file the old way:

require_once 'src/image-attribution.php';

Then make use of the function commons_image_attribution:

$attribution = commons_image_attribution("Loewe_frontal.JPG");

The image can be passed as file name, full image URL or URL of the image page. The value null will return a random image. If the image is found with a license, an array is returned with the following fields:

field content
src URL of the image file
url URL of the image description page
license URI of the license or null if unknown
license_name short name of the license or null if unknown
attribution boolean value whether attribution is required, or null if unknown
sharealike boolean value whether share-alike is required, or null if unknown
creator creator of the image, or null if unknown
credit credit string to give attribution with creator and license
description image description as plain string, or null if unknown
date date of the image as plain string, or null if unknown
restrictions additional restrictions, such as "trademarked", or null
name (file)name of the image
mime image mime type
size image size in bytes
width image width in pixels
height image height in pixels

Examples

Directory example includes a web service (index.php) to query image attribution information as JSON. The service is deployed at https://image-attribution.herokuapp.com/ but may be slow or down from time to time. Please install at your own server if you need to use it frequently! To give an example:

Directory bin contains a command line script to get image attribution:

./bin/image-attribution Wikimedia-logo.svg 

All versions of image-attribution with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gbv/image-attribution contains the following files

Loading the files please wait ....