Code Monkey home page Code Monkey logo

cakephp-media-plugin's Introduction

##Database Fields

    create table users (
    id char(36) not null,
    file varchar(255) default null,
    dirname varchar(255) default null,
    basename varchar(255) default null,
    checksum varchar(255) default null,
    created datetime default null,
    modified datetime default null,
    primary key(id)
    );

##Installation

  1. Clone into /path/to/app/Plugin git clone https://[email protected]/aeolu/CakePHP-Media-Plugin.git Media
  2. Add as a submodule git submodule add https://[email protected]/aeolu/CakePHP-Media-Plugin.git Plugin/Media
  3. Load the plugin.
    ``//Within you bootstrap.php``
    ``CakePlugin::load('Media');``
    ``require_once APP . 'Plugin/Media/config/core.php';``
  1. Initialize Media files. cake Media.Media init
---------------------------------------------------------------
Media Shell
---------------------------------------------------------------
Do you want to create missing media directories now?  
[n] > y``
/app/webroot/media/                               [OK  ]
/app/webroot/media/static/                        [OK  ]
/app/webroot/media/static/aud                     [OK  ]
/app/webroot/media/static/doc                     [OK  ]
/app/webroot/media/static/gen                     [OK  ]
/app/webroot/media/static/img                     [OK  ]
/app/webroot/media/static/vid                     [OK  ]
/app/webroot/media/transfer/                      [OK  ]
/app/webroot/media/transfer/aud                   [OK  ]
/app/webroot/media/transfer/doc                   [OK  ]
/app/webroot/media/transfer/gen                   [OK  ]
/app/webroot/media/transfer/img                   [OK  ]
/app/webroot/media/transfer/vid                   [OK  ]
/app/webroot/media/filter/                        [OK  ]

Your transfer directory is missing a htaccess file to block requests.
Do you want to create it now?  
[n] > n
  1. Set the permissions for the Media folder:
chmod 777 -R webroot/media/{transfer,filter}

##Upload and View Image

  1. Set the model as media transfer user
````
  1. Set the form:
``echo $this->Form->create('User', array('type'=>'file'));``
``echo $this->Form->input('file', array('type'=>'file'));``
``echo $this->Form->input('dirname', array('type'=>'hidden'));``
``echo $this->Form->input('basename', array('type'=>'hidden'));``
``echo $this->Form->input('checksum', array('type'=>'hidden'));``
``echo $this->Form->end(__('Submit'));``
  1. To view image:
``Html->image( '../media/transfer/img/' . h($employee['User']['basename']), array('alt' => __('Profile Picture'), 'border' => '0')); ?>``
  1. ENJOY!

cakephp-media-plugin's People

Contributors

mariuswilms avatar adriengibrat avatar bmcclure avatar slywalker avatar thomheymann avatar rchavik avatar sitedyno avatar vstabile avatar gmomchilov avatar

Stargazers

Ryan Snowden avatar

Watchers

Ryan Snowden avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.