Download the PHP package 3xw/attachment without Composer
On this page you can find all versions of the php package 3xw/attachment. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package attachment
this project as moved!
Please use 3xw/cakephp-attachment instead!!
Attachment plugin for CakePHP ^3.7
Attachment plugin solves common problems with media, files and embed data. The goal is to store files where you want ( Dropbox, AWS S3, ... ) and keep a record of it in a table.
Attachment offers both storage layer and database layer as well as frontend and backend solutions for common needs.
It uses CakePHP 3, Flysystem and Intervention Image
Installation
Installation.composer
You can install this plugin into your CakePHP application using composer.
The recommended way to install composer packages is:
Installation.load
In src/Application.php
Alternatively you can overload with your own settings (config/attachment.php):
Installation.db
a sql file can found at path:
Installation.folders
Create a thumbnails folder with appropriate chmod to enable php to write in it...
If you store your files locally, then create a folder according to default settings or your own. For default set as follow:
BackendDependencies
BackendDependencies.libs
In order to use backend tools you need to have following libs installed:
javascript:
css:
BackendDependencies.html
Vuejs components are nested to a top parent you need to setup. It requires one extra block (template). Following is easy to achieve.
in your layout.ctp:
BackendDependencies.js
in your app.js
Settings
Default settings are present at following path: vendor/3xw/attachment/config/attachment.php
feel free to write your own at following path: config/attachment.php
Exemple of settings:
Settings.profiles
You can set up your profiles according to Flysystem doc just add baseUrl in order to retrieve full urls. Profiles are stored by name. So you can split your file in sevral systems.
Attachment comes prepact with three default settings:
default // Local file system stored in webroot/files
external // used for external urls
cache // for thumbs creations
following is the default adptater for local storage:
So you can use your own or install new one with composer.
Settings.upload
The upload is made before saving a realted records. global settings are setup under Attachment.upload. You can set global behaviors and then override them local in add.ctp or edit.ctp. Sevral options are avaliable here:
Restrictions are behaviors used in backend to sort files.
Settings.listeners
Listeners are Events Handlers that are executed once their relative event is triggered. You can set handlers for a genral purpose in the attachment config file, or you can add the 'lsiteners' key to setting arrays of any Attachment Helper functions with CRUD ability.
Events triggered list is:
Listners should extend the BaseListener class:
Settings.thumbnails
Attachment.thumbnails is the settings for thumbs generation.
This settings are global and restirct local changes in order to keep logic of thumb in one file and limit extra formats. each table are possibility you allow. So only 600px and 1200px thumbs are allowed. Only crop of 4:3 and 16:9 are allowed.
Usage
Usage.model
Attachment is two tables: Attachments and Atags. So you can bind any of your models with, all relations types are supported.
Attachment handles an 'order' field as well. So feel free to add such a field in your HABTM join tables...
Usage.controller
Simply use contain or any join you need...
Usage.view
All skills are in the Helper Attachment. So first of All add it into your AppView.
in src/View/AppView.php
Usage.view.backend
In add.ctp
In edit.ctp
Global Attachments index :
TinyMCE Plugin
Attachment comes with a TinyMCE plugin. Working with package cakephp-tinymce
This will let you insert image right into trumbowyg textarea !!! heepee!
Exemple in locale.ctp:
Usage.view.frontend
in file
Url Only
Usage.view.download
Usage.shell
1) Attachment plugin provides a usefull shell script to retrieve width and height of images
2) CReate missing attachment transaltions for loacle:
All versions of attachment with dependencies
cakephp/cakephp Version ~3.3
friendsofcake/crud Version ^5.0
friendsofcake/search Version ^5.1
wyrihaximus/fly-pie Version ^1.1
league/flysystem-aws-s3-v3 Version ^1.0
intervention/image Version ^2.3
cakephp/migrations Version @stable
firebase/php-jwt Version ^5.0
3xw/cakephp-utils Version ^3.6