Download the PHP package marcohern/dimages without Composer

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

dimages

Simple Image management for Laravel. Very usefull if you are developing a Laravel API for Mobile Applications, dimages can resample images depending on what the image will be used for and the devices density.

Installation

Download and install laravel.

Dimages allows images to be downloaded by the public. However, uploading images can only be done through authentication, by way of the auth:api middleware. The easiest way to achieve api authentication is to use laravel/passport. Note: laravel/passport requires a database, so make sure you have one set up.

So download, install, and configure laravel passport:

This will install passport and all it's dependencies.

You will get an output similar to:

This creates 2 grants for Signing in. The first one is a Personal access client, which we will ignore for now. The second one is a Password grand which is the one we will use to log in. So remember the second Client secret, we will use it as an API key of sorts to log into the api. Now, In the mean time, you need to create a user to log in with, lets create a seeder to add a user.

This creates the seeder class in database/seeds folder, lets add the code:

The code contains a bunch of users for testing, we can use any of those to log in. To run the seeder, run the following command:

So now we have passport working, and users to log in with. We can now use composer to install marcohern/dimages

At this point, the library is installed. But you need to install the configuration file.

Run the following command:

A list of publishables appear, pick the one labeled config.

At that moment you will see the following message output:

This means that the configuration has been deployed. Finally, by typing the following command:

A list of routes will appear. If routes with prefixes dimage, dimaages and dimagesettings appear, then the library is working and installed.

You are now ready to use the library.

Using dimages

dimages exposes endpoints that help you manage images, and download them for specific profiles and density.

To make sure to get a result in JSON format, make sure to add header Accept: application/json.

Uploading one or more images

Example

Parameters

tenant: The user or tenant of the image, it can be a code, slug, or username. such as mike or user1234.

entity: Entity of the image. such as user, user-profile or albums.

identity: Reference to the object attached to the image, such as the username or a slug. Examples: john-doe, my-album-2020-01-22.

image: (in body) Upload a file in a field called image. Content-Type must be application/x-www-form-urlencoded.

Returns

You can only upload one image per request. If you upload more than one image (with multiple requests), each image will return an index number, the first one being 0, then 1, and so on.

Downloading uploaded images

Examples

Parameters

tenant: The user or tenant of the image, it can be a code, slug, or username. such as mike or user1234.

entity: Entity of the image. such as user, user-profile or albums.

identity: Reference to the object attached to the image, such as the username or a slug. Examples: john-doe, my-album-2020-01-22.

index: (optional) the index of the image. If no index is specified, index zero (0) is used.

Returns

Returns the source image, in it's original size, as it was uploaded.

Downloading uploaded images in different sizes

Examples

Parameters

tenant: The user or tenant of the image, it can be a code, slug, or username. such as mike or user1234.

entity: Entity of the image. such as user, user-profile or albums.

identity: Reference to the object attached to the image, such as the username or a slug. Examples: john-doe, my-album-2020-01-22.

profile: The profile of the image. The profile is essentially a reference to what the image will be used for, such as, as an icon, or a cover. Essentially it defines the aspect ratio.

density: Reference to the object attached to the image, such as the username or a slug. Examples: john-doe, my-album-2020-01-22.

index: (optional) the index of the image. If no index is specified, index zero (0) is used.

Returns

The image in the appropriate size.

Configuring image sizes

The image sizes can be configured in the config/dimages.php file. There are settings to begin with.

densities: A list of densities in inches per pixel. This will used to calculate the size of any image requested with the specified density. You can add new density multipliers if you like.

profiles: A list of image sizes in pixels. It is the size of the image if the density was equal to 1 (mdpi). Sizes are calculated by multiplying the specified density with each dimension of the specified profile. In principle, you will be adding more profiles as your app requires.

Examples:

Deleting images

Examples

Parameters

tenant: The user or tenant of the image.

entity: Entity of the image.

identity: Identity.

index: (optional) the index of the image. Images with the matching index will be deleted. If not specified, all images associated with the identity will be deleted.

Other endpoints available

Installation fo Development Environment

To install dimages to develop for it, follow these steps.

  1. Install a new Laravel application that you will use for running and testing your development. Let's call it laravel_packages.
  2. In the root folder, create a packages/marcohern folder.
  3. In packages/marcohern folder, checkout dimages source in a dimages folder. In the end, the path to the cloned repository should be in: /path/to/your/workspace/laravel_packages/marcohern/dimages/

At this point, you must register the package in laravel:

  1. Add the DimagesServiceProvider to the providers list in the config/app.php file.

  2. Include the package source files in the composer.json file autoload section. Include the dimages namespace/source folder in the psr-4 list, and the Helper.php in the files list.

  3. Finally, run composer dump-autoload.

At this point, the package module should be working. Test it by opening the module's main route.

  1. Run php artisan serve on the laravel project.

  2. Open a browser and access the package module with the following url: http://localhost:8000/mh/dim/api/status. This should return a 200 and a json with success = true. You are all set!

All versions of dimages with dependencies

PHP Build Version
Package Version
Requires intervention/image Version ^2.5
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 marcohern/dimages contains the following files

Loading the files please wait ....