Download the PHP package tobento/service-picture-generator without Composer

On this page you can find all versions of the php package tobento/service-picture-generator. 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 service-picture-generator

Picture Generator Service

The Picture Generator Service provides a powerful, framework-agnostic system for generating responsive images and <picture> elements in PHP applications.
It enables developers to define reusable picture configurations, generate optimized image variants, and store metadata for fast retrieval - all without relying on URL-based transformations.

The service is designed to be secure, predictable, and fully decoupled from HTTP.
It supports synchronous and queued generation, integrates with any file-storage backend, and outputs standard HTML <picture> elements that work in any PHP framework or templating system.

Key Features

Table of Contents

Getting Started

Add the latest version of the picture generator project running this command.

Requirements

Documentation

Workflow

When you display a picture, the service checks whether the required images for the given path and definition already exist.

This workflow ensures fast responses when using background processing, while still allowing on-demand synchronous generation when needed.

Fallback Images

If a picture cannot be generated immediately (for example, when queueing is enabled), a fallback image is returned:

Basic Usage

Once you have created the Picture Generator, you can use it to display responsive pictures based on a path, resource, and definition.

Within your view file, call the generate method and render the returned picture tag:

Example Using a Named Definition

Named definitions allow you to reuse picture configurations across your application.
See the Picture Definitions section for how to register them.

About allowPrivateStorage

Use this option when the image source is a private storage.
(For most cases, using a public storage as the image source is recommended.)

Depending on your definition, the output may look like:

Using named definitions provides several advantages:

Example Using a Definition Instance

See the Picture Definition section for more details on defining picture configurations.

Example Using an Imager Resource

See Picture Creating - Create Picture From Resource for more information.

Creating Picture Generator

To use the picture generator, you first need to create the required components:
a PictureRepository, an optional PictureQueueHandler, and finally the PictureGenerator itself.

Private Storage Behavior

When generating pictures from private file storage, the behavior depends on the allowPrivateStorage and queue parameters:

Condition Behavior
allowPrivateStorage = false Returns a NullPictureTag and does not queue a job
allowPrivateStorage = true and queue = false Generates the picture synchronously
allowPrivateStorage = true and queue = true Queues a job and returns a fallback image

Related Documentation

Queue Worker

If you use background image generation via the queue handler,
you may install the Console Service to run the queue worker:

See the Queue Service - Console for details on running the worker.

Unique Jobs

The queue handler uses unique jobs by default.
To enable unique job locking, the Queue Service requires a PSR-16 CacheInterface implementation.

You may use any PSR-16 compatible cache. For example, if you use a container and want a simple drop-in implementation:

See the Queue Service - Unique Parameter
for details on how unique job locking works and how to provide your own cache.

Warning:
If unique jobs are disabled or no cache is available, duplicate picture generation jobs may be queued and processed. This can lead to redundant work, increased queue load, and multiple workers generating the same images.

Logging

If a LoggerInterface is provided, the picture generator may log useful information such as picture generation steps, queue dispatching, or errors that occur during processing. Logging is optional and depends on the logger implementation you supply.

Picture Definitions

Picture definitions can be stored wherever you prefer.
You are free to organize them in any directory structure that fits your application.

A common convention is to place JSON definition files inside a dedicated folder, for example:

For a detailed explanation of how JSON-based definitions work, how they are structured, and how to load them, see the
Json Files Definitions section of the Picture Service documentation.

Clearing Generated Pictures

You can clear (delete) generated pictures either via the console command or directly through the PictureGenerator.

Using Console Command

See Picture Clear Command section.

Using Picture Generator

Console

Picture Clear Command

This package integrates with the Console Service to provide a command for clearing generated pictures.

Requirements

Example

To clear all generated pictures, run:

To clear generated pictures for specific definitions only:

Using the App Ecosystem

If you are building on the Tobento App Ecosystem, you may use the app-media package, which automatically configures the picture generator, queue worker, cache, and storages. In that case, no manual setup is required.

Framework Integration Notes

This package is framework-agnostic.
If you integrate it into a framework that provides its own queue or filesystem (e.g. Laravel, Symfony, etc.), you may need to implement small adapters:

These adapters are typically thin wrappers, as both interfaces are intentionally minimal.

Credits


All versions of service-picture-generator with dependencies

PHP Build Version
Package Version
Requires php Version >=8.4
psr/log Version ^3.0
league/mime-type-detection Version ^1.16
tobento/service-file-storage Version ^2.0
tobento/service-imager Version ^2.0
tobento/service-picture Version ^2.0
tobento/service-queue Version ^2.0
tobento/service-tag Version ^2.0
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 tobento/service-picture-generator contains the following files

Loading the files please wait ...