my code stock.com

15/05/2012

Snippet options

Download: Download snippet as controllersprocesarfotophp.php.
Copy snippet: For this you need a free my code stock.com account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

<?php 




if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Procesarfoto extends CI_Controller {

	public function __construct()
    {
        parent::__construct();
        error_reporting(E_ALL | E_STRICT);
		$this->load->library('blueimp');
        
    }
    
    public function index()
    {
    
    	
		
		header('Pragma: no-cache');
		header('Cache-Control: no-store, no-cache, must-revalidate');
		header('Content-Disposition: inline; filename="files.json"');
		header('X-Content-Type-Options: nosniff');
		header('Access-Control-Allow-Origin: *');
		header('Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST, PUT, DELETE');
		header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size');
		
		
		switch ($_SERVER['REQUEST_METHOD']) {
		    case 'OPTIONS':
		        break;
		    case 'HEAD':
		    case 'GET':
		        $this->blueimp->get();
		        break;
		    case 'POST':{
		    	$album_id = (int)$_POST['album'];
		    	$this->blueimp->setAlbumId($album_id);
		        if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
		            $this->blueimp->delete();
		        } else {
		            $this->blueimp->post();
		        }
		        break;
		    }
		    case 'DELETE':{
		        $this->blueimp->delete();
		        break;
		    }
		    default:
		        header('HTTP/1.1 405 Method Not Allowed');
		}
    
    }
    
    public function album(){
    header('Pragma: no-cache');
		header('Cache-Control: no-store, no-cache, must-revalidate');
		header('Content-Disposition: inline; filename="files.json"');
		header('X-Content-Type-Options: nosniff');
		header('Access-Control-Allow-Origin: *');
		header('Access-Control-Allow-Methods: OPTIONS, HEAD, GET, POST, PUT, DELETE');
		header('Access-Control-Allow-Headers: X-File-Name, X-File-Type, X-File-Size');
		
		
		switch ($_SERVER['REQUEST_METHOD']) {
		    case 'OPTIONS':
		        break;
		    case 'HEAD':
		    case 'GET':
		        $this->blueimp->get();
		        break;
		    case 'POST':{
		    	$album_id = (int)$_POST['album'];
		    	$this->blueimp->setAlbumId($album_id);
		        if (isset($_REQUEST['_method']) && $_REQUEST['_method'] === 'DELETE') {
		            $this->blueimp->delete();
		        } else {
		            $this->blueimp->post();
		        }
		        break;
		    }
		    case 'DELETE':{
		        $this->blueimp->delete();
		        break;
		    }
		    default:
		        header('HTTP/1.1 405 Method Not Allowed');
		}
    }
}

Create a free my code stock.com account now.

my code stok.com is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.