Download the PHP package 68publishers/image-storage without Composer

On this page you can find all versions of the php package 68publishers/image-storage. 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-storage

Image Storage

:city_sunset: Extension for 68publishers/file-storage that can generate images on-the-fly and more!

Based on thephpleague/flysystem and intervention/image

Checks Coverage Status Total Downloads Latest Version PHP Version

Installation

The best way to install 68publishers/image-storage is using Composer:

Integration into Nette Framework

Firstly, please read a documentation of 68publishers/file-storage.

File storage configuration example

Each image-storage is based on file-storage. so firstly we need to register our storage under the file-storage extension. Here is an example configuration:

Storage config options

Name Type Default Description
base_path string '' Base path to a directory where the files are accessible.
host null or string null Hostname, use if the files are not stored locally or if you want to generate an absolute links
version_parameter_name string _v A query parameter's name used for a file's version (just for a cache).
signature_parameter_name string _s A query parameter's name used for a signature token.
signature_key null or string null Your private signature key used for a token encryption. Signatures in requests are checked and validated only if this parameter is set.
signature_algorithm string sha256 An algorithm used for encryption of signatures (HMAC).
modifier_separator string , A separator for modifier definitions in a path. For example if you set this parameter as ; then a modifier string in a path will look like this: w:100;o:auto.
modifier_assigner string : An assigner for modifier definitions in a path. For example if you set this parameter as = then a modifier string in a path will look like this: w=100,o=auto.
allowed_pixel_density array or array [] An array of allowed pixed densities. The validation is enabled when the array is not empty.
allowed_resolutions array [] An array of allowed resolutions like 100x, x200 or 100x200. The validation is enabled when the array is not empty.
allowed_qualities array [] An array of allowed qualities. The validation is enabled when the array is not empty.
encode_quality int 90 An encode quality for cached images.
cache_max_age int 31536000 The maximum cache age in seconds. The value is used for HTTP headers Cache-Control and Expires.

Image storage configuration example

Now we can register the ImageStorageExtension and define the local image-storage:

Animated GIFs

Animated GIFs are not supported by intervention/image but this package comes with a custom imagick driver that supports it. The driver is used when you pass a value 68publishers.imagick into a driver option.

Basic usage

Basic usage is similar to usage of the file-storage.

Persisting files

Files persisting is almost the same as persisting in the file-storage but source images are stored without a file extension.

Check a file existence

Deleting files

Create links to images

An original images are not accessible. If you want to access an original image you must request it with a modifier ['original' => TRUE].

The HTML attribute srcset can be also generated:

Usage with Latte

The extension adds these functions into the Latte:

Basic usage:

An advanced example with a tag <picture>:

Symfony Console commands

The image-storage extends a command file-storage:clean with an option cache-only so the command now looks like this:

Supported image formats and modifiers

Image formats

Modifiers

Name Shortcut Type Note
Original original - A modifier without a value, use it if you want to return the original image
Height h Integer Can be restricted by parameter AllowedResolutions
Width w Integer Can be restricted by parameter AllowedResolutions
Pixel density pd Integer or Float Can be restricted by parameter AllowedPixelDensity
Aspect ratio ar String Required format is {Int or Float}x{Int or Float} and a height or a width (not both) must be also defined. For example w:200,ar:1x2 is an equivalent of w:200,h:400
Fit f String See supported fits for the list of supported values
Orientation o Integer or String Allowed values are auto, 0, 90, -90, 180, -180, 270, -270
Quality q Integer Can be restricted by parameter AllowedQualities

Supported fits

Image server

Local image server

The default image server for each storage is local. That means your application will handle requests and generate, store and serve modified images. The extension automatically registers ImageStoragePresenter and Routes for local storages if the route: true option is set for the storage. If you have this setting disabled, you must register the Presenter yourself.

Now you must modify the configuration of a web server. For example, if the webserver is Apache then modify a file .htaccess that is located in your www directory.

The Application will be called only if a static file has not yet been generated. Otherwise, the server will serve the static file.

External image server: an integration with AWS S3 and image-storage-lambda

The image storage can be integrated with the Amazon S3 object storage and the package 68publishers/image-storage-lambda. So your image storage can be completely serverless! Of course, you can deploy the image-storage-lambda application manually and also synchronize options from the image-storage with the image-storage-lambda manually.

At least you can follow these simple steps for a partial integration:

1) Create a deployment bucket on the S3

When you deploy the AWS SAM application in guide mode (sam deploy --guided) the deployment bucket will be created automatically. But the application will be built in a non-guided mode so we must create the bucket manually. If you don't know how to create an S3 bucket please follow the Amazon documentation. We recommend to enable versioning on this bucket.

2) Required packages league/flysystem-aws-s3-v3 (the S3 adapter for Flysystem) and yosymfony/toml (suggested by this package) in your application

3) Configure the image storage with the S3 filesystem (an example with a minimal configuration):

4) Register and configure the compiler extension ImageStorageLambdaExtension

5) Generate configuration for the image-storage-lambda

The configuration file will be placed by default in a directory app/config/image-storage-lambda/my-awesome-image-storage/samconfig.toml. Keep this file versioned in the Git.

6) Download image-storage-lambda, build and deploy!

Firstly setup your local environment by requirements defined here. Then download the package outside your project.

Unfortunately SAM CLI doesn't allow you to define a path to your samconfig.toml file (related issue https://github.com/awslabs/aws-sam-cli/issues/1615) at this moment. So you must copy the config to the root of the image-storage-lambda application. And then you can build and deploy the application!

7) Set the CloudFront URL as a host in the image storage config

The URL of your CloudFront distribution is listed in Outputs after a successful deployment. More information are here.

Contributing

Before opening a pull request, please check your changes using the following commands


All versions of image-storage with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
ext-json Version *
68publishers/file-storage Version ^1.1.1
intervention/image Version ^2.7.2
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 68publishers/image-storage contains the following files

Loading the files please wait ....