Download the PHP package escolalms/images without Composer

On this page you can find all versions of the php package escolalms/images. 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 images

Image processing module

swagger codecov phpunit downloads downloads downloads Maintainability Test Coverage

What does it do

The package creates resized images from source by given parameters. This is a headless approach so the backend doesn't know the requested sizes before frontend requests any.

The input images are stored by Laravel in any of available disk (local storage/s3/any bucket). Once a resized version is requested a cached version in created and returend. Below are examples to show the overall idea.

The initial resize is done by Intervention/image with GD driver. That can be configured.

After inital resized all the images are optimized with image-optimizer.

For best results binaries must be installed. EscolaLMS prepared Docker Images are available for development (tag work) and production (tag prod).

Installation

Database

id path hash_path created_at updated_at
1 avatars/1/avatar.jpg imgcache/68840270724ee4ff0b481f4fbd2299e13dfe2447.jpg 2022-05-05 11:29:04 2022-05-05 11:29:04
3 avatars/4/avatar4.jpg imgcache/d0f1ab43ae7f2924682b2ce734a24fa7066a8ea7.jpg 2022-05-05 11:30:49 2022-05-05 11:30:49
2 avatars/2/avatar2.jpg imgcache/94c6c83db6562161d38620a74e4e07fb3d9e39ed.jpg 2022-05-05 11:30:39 2022-05-05 11:30:39

Examples

Default. One image as 302 redirect result .

Basic resize is made by URL API call which redirects to new created file

Example GET call

Resizing many images at once. JSON array as a result.

Example POST call like

generates following result

Hashing algorithm

There is simple algorithm to guess the result image URL. This allows frontend application to know the processed URL without calling API. As follows

then result URL would be

Endpoint

There is API endpoints documentation swagger

Tests

Run ./vendor/bin/phpunit to run tests.

Test details codecov phpunit

Events

This package extends filesystem.

  1. FileDeleted - The event is dispatched when you use delete method on the Storage facade.
  2. FileStored - The event is dispatched when you use put, putFile or putFileAs method.

Listeners

This package listens for FileDeleted and FileStored events and removes the resized images from the given path.

How to use this on frontend

Below is our totally headless approach on generating images

The following example tries to achives 2 purposes

The idea is that since we know tha hashing algoritm for cached images we can guess that the URL will be like. If that URL is throwing 404 then we're calling the API endpoint to generate one. Fortunately this endpoint creates an requested image, caches it and returns redirect which is good for image src.

A major disadvantage of this approach is that first user once will get 404 in networking and experince few seconds delay before image is rendered after not founded.

Working example is availabe in doc folder.


All versions of images with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
laravel/framework Version >=8.0
escolalms/core Version ^1
intervention/image Version ^2
intervention/imagecache Version ^2
spatie/laravel-image-optimizer Version ^1.7.1
escolalms/settings Version ^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 escolalms/images contains the following files

Loading the files please wait ....