waldemarnt/media

Multi upload plugin

v1.0.0 2014-10-20 01:21 UTC

This package is not auto-updated.

Last update: 2024-11-05 02:58:43 UTC


README

This is a multiupload plugin to cakephp.

Install

install via composer: reference: waldemarnt/media

install manual:

copy to app/Plugin folder and run composer update comand to download WideImage

create table

CREATE TABLE media ( id int(11) NOT NULL AUTO_INCREMENT, path varchar(255) NOT NULL, name varchar(255) NOT NULL, model_name varchar(255) NOT NULL, model_id int(11) NOT NULL, size int(11) DEFAULT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;

Using

First you need load into your bootstrap.php file;

CakePlugin::load('Media');

Now you need add this parameter into your Model;

public $actsAs = array(
	'Media.Media'=>array(
		'thumb_size'=>array(
			'width'=>100,
			'height'=>100
			)
		)
	);

You need add public $helpers = array("Media.Media"); to your controller or app controller, to use Media plugin file upload helper.

Now in your view you need this field

Media->file(); ?>

To show uplaoded files you need in your view

Element('Media.show'); ?>

Now it's works fine :D