2017 © Pedro Peláez
 

cakephp-plugin cakephp-image-manager

CakePHP Image Manager plugin

image

a2design-inc/cakephp-image-manager

CakePHP Image Manager plugin

  • Monday, November 9, 2015
  • by rabbiabram
  • Repository
  • 17 Watchers
  • 6 Stars
  • 63 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 1 Open issues
  • 8 Versions
  • 0 % Grown

The README.md

CakePHP-ImageManager-Plugin

Setting up

Put this into your Cake's plugin directory, (*1)

In your model

    public $actsAs = array('ImageManager.ImageManager');

    // Gallery
    public $hasAndBelongsToMany = array(
            'Image' => array(
                'className' => 'ImageManager.Image',
                'foreignKey' => 'foreign_id',
                'associationForeignKey' => 'image_id',
                'joinTable' => 'images_relations',
                'conditions' => array('foreign_name' => 'Page')
            ),
        );

    // One image
    // Name of association should by 'ModelField'
    public $belongsTo = array(
            'PageImageId' => array(
                'className' => 'ImageManager.Image',
                'foreignKey' => 'image_id',
            )
        );

In your layout

    echo $this->Html->script(Router::url(array(
            'controller'=> 'images',
            'action' => 'scripts',
            'full_base' => true,
            'admin' => false,
            'plugin' => 'image_manager',
    )));
    echo $this->Html->script('ImageManager.image_manager');
    echo $this->Html->script('ImageManager.jquery.drag.drop');
    echo $this->Html->css('ImageManager.image_manager');

In your config file

    Configure::write(
        array (
            'ImageManager.Upload' => array(
                'filename' => array(
                    'thumbnailSizes' => array(
                        'small' => '500x500',
                        'thumb' => '253x158',
                        'big' => '800l',
                        'nano' => '100x100',
                        'pico' => '70x70',
                    )
                ),
            )
        )
    );

In your controller

    public $helpers = array(
            'ImageManager.ImageManager'
        );

Run MySQL script

    CREATE TABLE `images` (
          `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
          `foreign_key` int(10) unsigned DEFAULT NULL,
          `model` varchar(255) NOT NULL DEFAULT '',
          `filename` varchar(255) NOT NULL DEFAULT '',
          `dir` int(11) unsigned DEFAULT NULL,
          `order` int(11) unsigned DEFAULT NULL,
          `is_slider` int(2) unsigned DEFAULT NULL,
          `site_id` int(11) unsigned DEFAULT NULL,
          PRIMARY KEY (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

    CREATE TABLE `images_relations` (
          `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
          `foreign_id` int(11) unsigned NOT NULL,
          `foreign_name` varchar(255) NOT NULL,
          `image_id` int(11) unsigned NOT NULL,
          PRIMARY KEY (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8;

Usage

// One image
ImageManager->image('Page.image_id'); ?>

// Gallary
<?php echo $this->ImageManager->gallery('Gallery'); ?>

The Versions

09/11 2015

dev-master

9999999-dev

CakePHP Image Manager plugin

  Sources   Download

MIT

The Requires

 

by Vladislav Bezverkhiy
by Vyacheslav Gordeev

26/08 2015

v0.5

0.5.0.0

Image Manager CakePHP plugin

  Sources   Download

MIT

The Requires

 

by Vladislav Bezverkhiy
by Vyacheslav Gordeev

26/08 2015

v0.4

0.4.0.0

Twilio CakePHP plugin

  Sources   Download

MIT

The Requires

 

by Vladislav Bezverkhiy
by Vyacheslav Gordeev

26/08 2015

v0.3

0.3.0.0

Twilio CakePHP plugin

  Sources   Download

MIT

The Requires

 

by Vladislav Bezverkhiy
by Vyacheslav Gordeev

26/08 2015

dev-bootstrap3

dev-bootstrap3

CakePHP Image Manager plugin

  Sources   Download

MIT

The Requires

 

by Vladislav Bezverkhiy
by Vyacheslav Gordeev

26/08 2015

v0.2

0.2.0.0

Twilio CakePHP plugin

  Sources   Download

MIT

The Requires

 

by Vladislav Bezverkhiy
by Vyacheslav Gordeev

15/07 2015

v0.1.1

0.1.1.0

Twilio CakePHP plugin

  Sources   Download

MIT

The Requires

 

by Vladislav Bezverkhiy

15/07 2015

v0.1.0

0.1.0.0

Twilio CakePHP plugin

  Sources   Download

MIT

The Requires

 

by Vladislav Bezverkhiy