PHPackages                             catpkt/picture-provider - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. catpkt/picture-provider

ActiveLibrary[File &amp; Storage](/categories/file-storage)

catpkt/picture-provider
=======================

Store pictures and provider uris for third part.

08PHP

Since Jul 20Pushed 8y ago1 watchersCompare

[ Source](https://github.com/catpkt/picture-provider)[ Packagist](https://packagist.org/packages/catpkt/picture-provider)[ RSS](/packages/catpkt-picture-provider/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Picture Provider
================

[](#picture-provider)

Store pictures and provider uris for third part.

Apis:
-----

[](#apis)

```
Upload a Picture
	POST /{app}
	param
		dir
			in query
			defaut
				/
		content-type
			in header
		content
			in body
			binary
	response
		200
			hash
				in body
				string

Get the Urls of a Picture
	GET /{app}/urls
	param
		hash
			in query
		sizes
			in query
			array
	response
		200
			urls
				in body
				array
				example
					100x100:http://...

Get the origin Url of a Picture
	GET /{app}/url
	param
		hash
			in query
	response
		200
			url
				in body
				string

Get the Content of a Picture
	GET /{app}/content
	param
		hash
			in query
	response
		200
			content
				in body
				binary

Preview the Pictures in the directory
	GET /{app}
	param
		dir
			in query
		sizes
			in query
			array
	response
		200
			list
				in body
				array

Delete Picture
	DELETE /{app}
	param
		path
			in query
	response
		200 Success
		404 No such Picture
		502 503 Failed
	comment
		Only delete Picture relation from the directory, never real delete the picture from storage

Copy Picture
	PATCH /{app}
	param
		path
			in form
		dir
			in form

Move Picture
	PATCH /{app}
	param
		path
			in form
		dir
			in form

```

Usage
-----

[](#usage)

##### 1. Create classes extends `\CatPKT\PictureProvider\AApp` and `\CatPKT\PictureProvider\AStorage`, and a class implements `\CatPKT\PictureProvider\IPicture`.

[](#1-create-classes-extends-catpktpictureprovideraapp-and-catpktpictureproviderastorage-and-a-class-implements-catpktpictureprovideripicture)

```
use CatPKT\PictureProvider as CP;

////////////////////////////////////////////////////////////////

class FooPicture implements IPicture
{
	public function getOriginUrl():string {}
	public function getUrlBySize( int$width, int$height ):string {}
	public function getContent():string {}
	public function getHash():string {}
}

class BarApp extends CP\AApp
{
	protected function createEncryptor():CP\Encryptor {}
}

class BazStorage extends CP\AStorage
{
	protected function findApp( string$appName ):CP\AApp {}                                          // Returns instance of BarApp actually.
	public function list( string$dir ):CP\PictureList {}
	public function get( string$hash ):CP\IPicture {}                                                // Returns instance of FooPicture actually.
	public function store( string$content, string$dir='/', string$contentType=null ):CP\IPicture {}  // Returns instance of FooPicture actually.
	public function delete( string$path ):bool {}
	public function copy( string$path, string$dir ):bool {}
	public function move( string$path, string$dir ):bool {}
}
```

##### 2. Create a instance of `CatPKT\PictureProvider\PictureProvider` and handle the request.

[](#2-create-a-instance-of-catpktpictureproviderpictureprovider-and-handle-the-request)

```
use CatPKT\PictureProvider as CP;
use Symfony\Component\HttpFoundation\Request;

////////////////////////////////////////////////////////////////

$pictureProvider= new CP\PictureProvider(
	new BarStorage();
);

$request= Request::createFromGlobals();

try{
	$response= $pictureProvider->handle( $request );
}
```

##### 3. Catch Exceptions or Errors if exists, and send the response.

[](#3-catch-exceptions-or-errors-if-exists-and-send-the-response)

```
catch( \Throwable$e )
{
	#
}

$response->send();
```

With framework
--------------

[](#with-framework)

Ordinarily you whould use a framework to build your picture provider. Just use this library in your controller and route all request in [Apis](#apis) to this controller. And just return the response and let framework send it.

###  Health Score

20

—

LowBetter than 13% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 76.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/24599950?v=4)[CatPKT](/maintainers/CatPKT)[@catpkt](https://github.com/catpkt)

---

Top Contributors

[![Fenzland](https://avatars.githubusercontent.com/u/19697989?v=4)](https://github.com/Fenzland "Fenzland (10 commits)")[![uukoo](https://avatars.githubusercontent.com/u/9957533?v=4)](https://github.com/uukoo "uukoo (2 commits)")[![catpkt](https://avatars.githubusercontent.com/u/24599950?v=4)](https://github.com/catpkt "catpkt (1 commits)")

### Embed Badge

![Health badge](/badges/catpkt-picture-provider/health.svg)

```
[![Health](https://phpackages.com/badges/catpkt-picture-provider/health.svg)](https://phpackages.com/packages/catpkt-picture-provider)
```

###  Alternatives

[venveo/craft-compress

Create smart zip files from Craft assets on the fly

124.7k](/packages/venveo-craft-compress)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
