A Cakephp component for Cloudinary cloud image service.
-
Download and extract Cloudinary PHP library from https://github.com/cloudinary/cloudinary_php to app/Vendor/Cloudinary
-
Download from https://github.com/ryanicle/cakephp-cloudinary-component
-
Set variables in app/Config/bootstrap.php
// Cloudinary.env - sign up and get this from http://cloudinary.com // Cloudinary.path - tmp path for images Configure::write( 'Cloudinary', array( 'env' => '', 'path' => APP . 'webroot' . DS . 'img' . DS . 'photos' ) );
-
Place CloudinaryComponent.php in app/Controller/Component/
-
Done!
Call the component in controller
class ExampleController extends AppController {
public $name = 'Example';
public $components = array(
'CloudinaryComponent'
);
public function index() {
// Assume you have already uploaded images to tmp locations
$this->Cloudinary->upload($file);
}
}
Currently, it only supports uploading and deleteing images.
Please feel free to drop me a note.