定制 gbv/image-attribution 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

gbv/image-attribution

最新稳定版本:0.3.0

Composer 安装命令:

composer require gbv/image-attribution

包简介

Get information for image attribution from Wikimedia Commons

README 文档

README

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 

统计信息

  • 总下载量: 72
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 6
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 6
  • Watchers: 6
  • Forks: 2
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-08-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固