Download the PHP package cbcaio/image-attacher without Composer

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

Image Attacher

Quality Score Build Status

This package uses polymorphic relationships to easily attach images to models. Basically you just need to use one of the package's traits in your model and you are good to go(see Usage). What happens in the background is that the models are linked to the images by a MorphOne relationship and every time you persist a image into the associated table the file is written automatically using the selected driver (using Flysystem), or updated if needed.

Install

1 - Via Composer

To get started with Image Attacher, add it to your composer.json file as a dependency:

2 - Provider

After installing the Image Attacher, register the CbCaio\ImgAttacher\Providers\ImgAttacherServiceProvider in your configuration file (config/app.php):

'providers' => [
    // Other service providers...

    CbCaio\ImgAttacher\Providers\ImgAttacherServiceProvider::class,
],

3 - Configuration

In order to publish the configuration files run the following command

This command will create 3 new files:

  1. config/img-attacher.php : this file holds the Image Attacher configurations.

    • path_to_save: defines where images will be saved, relatively to the driver and local specified in the flysystem.php. This path will be parsed before being used. The :attribute references information about the attacherImage model while the :owner_class and :owner_id are relative to the owner class of the relationship. These are needed to organize folders and also to certify that the right image will be deleted.

      IMPORTANT: This path should be exclusively used by the package, do not put other files in the same folder otherwise they can be deleted by mistake.

    • processing_styles and processing_style_routines: the 'routine' represents a sequence of 'styles' and its needed methods. Each 'style' saves a copy of the original image with the modifications specified in its method. They can be used to save different versions of your original image automatically when you add an image to a model (the model can can have different 'versions'/'styles' of same image with only one relationship).
      • For example, the following code will save the original image and also a 'thumbnail version' of the same image in their respective parsed path_to_save with :style substituted by original_style and thumbnail:
  2. database/migrations/2016_01_12_000000_create_attacher_images_table : this is a migration file to create the table which will hold the reference to your models in the MorthOne relationship and the information about the images.

  3. config/flysystem.php : this file is relative to the Flysystem. How and where your files will be written is defined here. It is important to say that this package is only tested using the 'local' driver.

Usage

To start attaching images to your models you just need to use one of the available traits (currently only hasImage) in the model.

 class RandomModel extends Model
 {
     use hasImage;
 }

1 - Basic of using the hasImage trait

Adding an image to the model from an uploaded file.
Retrieving an image from the model.
Adding another image
Deleting image and all the its styles

Change log

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONDUCT for details.

Security

If you discover any security related issues, please email :author_email instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of image-attacher with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ~5
illuminate/database Version ~5
graham-campbell/flysystem Version ~3.3
intervention/image Version ~2.3
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 cbcaio/image-attacher contains the following files

Loading the files please wait ....