Download the PHP package ziffmedia/laravel-eloquent-imagery without Composer

On this page you can find all versions of the php package ziffmedia/laravel-eloquent-imagery. 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 laravel-eloquent-imagery

Laravel Eloquent Imagery

Description

ziffmedia/laravel-eloquent-imagery takes a unique approach to handling images. Instead of treating images as model relations, they are treated as attributes of a model. To this end, image information is stored in a tables column (a model's attribute) at a given name. Additionally, this library handles image modifications (resizing, triming, backgrounds) when serving the image instead of at upload time. Images are stored in any of the configured kinds of file storage that Laravel supports.

Features:

Other Good Libraries

If this solution to the image problem does not appeal to you, Spatie's MediaLibrary is an excellent library that both treats images as Models as a Relation, and also has a concept of "conversions" that can be applied at upload time.

Installation

First, install the package:

$ composer require ziffmedia/laravel-eloquent-imagery

In Laravel 5.5+. this library will self-register. Next, you should publish the vendor (config) files:

$ artisan vendor:publish --provider="ZiffMedia\LaravelEloquentImagery\EloquentImageryProvider"

It is now ready to use.

Usage

Attaching An Image To A Model

In the simplest use case for a single image attached to a model, first create a json column in a migration to handle this image:

Next, in the model, add in the HasEloquentImagery trait and configure a class property called $eloquentImagery like so:

Attaching an Image Collection To A Model

An Image Collection is a ordered list of Image objects. The collection itself when hydrated has images that are indexable starting at 0. Each collection has a concept of an auto increment number which is stored in the collection (and the collection's serialization) so that Image objects can take advantage of this in the path template.

In the simplest use case, using a json column like in the direct image scenario above, add in the HasEloquentImagery trait as before, and use the eloquentImageryCollection method at construction to setup the collection:

Displaying An Image In A View

The following blade syntax assumes $post is a Model of type Post with an image attribute. This will generate a url similar to /imagery/post/11/image.png:

Using modifiers when generating the url, a url generated such as /imagery/post/11/image.@[email protected]

Image Modifiers

TODO

Detailed Configuration

The following table describes the available configuration options:

eloquent-imagery.filesystem

Default: env('IMAGERY_FILESYSTEM', 'public')

This is the filesystem images will be stored on at the image's path.

eloquent-imagery.render.enable

Default: true

Whether or not to enable the render route and modification functionality.

eloquent-imagery.render.path

Default: /imagery

The path prefix the route will live at and serve images from.

eloquent-imagery.render.placeholder.enable

Default: env('IMAGERY_RENDER_PLACEHOLDER_ENABLE', false)

Highly useful for dev purposes, consider enabling in local.

eloquent-imagery.render.placeholder.filename

default value _placeholder_

This identifies when a placeholder image is being requested.

eloquent-imagery.render.placeholder.use_for_missing_files

default value env('IMAGERY_RENDER_PLACEHOLDER_USE_FOR_MISSING_FILES', false)

If an image is requested that is not on the filesystem, enabling this will serve a placeholder instead (useful for dev).

eloquent-imagery.render.caching.enable

default value env('IMAGERY_RENDER_CACHING_ENABLE', true)

Whether or not the controller should use full request caching

eloquent-imagery.render.caching.driver

default value env('IMAGERY_RENDER_CACHING_DRIVER', 'disk')

Cache to the disk.

eloquent-imagery.render.caching.ttl

default value 60

How long the ttl for the cache is.

eloquent-imagery.render.browser_cache_max_age

default value 31536000

How long the browser should cache the image generated by this route for.

eloquent-imagery.force_unmodified_image_rendering

default value env('IMAGERY_FORCE_UNMODIFIED_IMAGE_RENDERING', false)

This will allow for the dynamic (controller) route or static route (link to storage, for example) to be selectively used based on if modifiers are present in the image request

Demo

Once cloned, cd demo directory. Inside there do the following:

If you wish to demo the Nova specific capabilities, you must first install the downloadable version of nova to demo/nova. Once it is there, continue with the above script from the top, then visit the examples at /nova in your browser.

TODO

Updating

Updating to 0.5.0


All versions of laravel-eloquent-imagery with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
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 ziffmedia/laravel-eloquent-imagery contains the following files

Loading the files please wait ....