Documentation

Below you can check all the methods of image CRUD with a simple example.

Method name Description Example
set_table Set the table name of your photo gallery $image_crud->set_table('example_1');
set_primary_key_field Set the primary key of your basic table that you have inserted at set_table $image_crud->set_primary_key_field('image_id');
set_url_field Set the url field name that you want to store the image name $image_crud->set_url_field('image_url');
set_image_path Set the folder path that you want to upload the image file starting from the base_url of your project without starting with "/" $image_crud->set_image_path('assets/uploads/slideshow-images');
render Rendering everything that you have setted. Or else you can tell it as "Make it work". Without this function nothing works. It is the core of the image crud and it works similar with the render method of grocery CRUD. $output = $image_crud->render();
set_ordering_field Simply set the table field that is responsible for the ordering. $image_crud->set_ordering_field('priority');
set_title_field The field name for quick editing the title of the image. $image_crud->set_title_field('image_title');
set_relation_field Will automatically add the parameter at the URL (e.g. photos/45 the 45 is the category id) and it is also adding a where clause to the photo gallery $image_crud->set_relation_field('category_id');
unset_delete Remove the delete button from all the images for this CRUD. $image_crud->unset_delete();
unset_upload Remove the upload button from the interface $image_crud->unset_upload();

 

First of all make sure that you have loaded the library. It is better to load it at the construct method like this:

function __construct()
{
        parent::__construct();
 
$this->load->library('image_CRUD');    
}

As you can see there is no need to have any other library or helper to make it work.

You are only 5 lines away...

A simple example (only 5 lines of code):

function example1()
{
$image_crud = new image_CRUD();
 
$image_crud->set_table('example_1');
 
//If your table have by default the "id" field name as a primary key this line is not required
$image_crud->set_primary_key_field('id');
 
$image_crud->set_url_field('url');
$image_crud->set_image_path('assets/uploads');
 
$output = $image_crud->render();
 
$this->_example_output($output);
}
via Ad Packs

Photo gallery with ordering

function example2()
{
$image_crud = new image_CRUD();
 
$image_crud->set_table('example_2');
 
$image_crud->set_primary_key_field('id');
$image_crud->set_url_field('url');
$image_crud->set_ordering_field('priority')
    ->set_image_path('assets/uploads');
 
$output = $image_crud->render();
 
$this->_example_output($output);
}

Photo gallery within a category

function example3()
{
$image_crud = new image_CRUD();
 
$image_crud->set_table('example_3');
 
$image_crud->set_primary_key_field('id');
$image_crud->set_url_field('url');
 
$image_crud->set_relation_field('category_id')
    ->set_ordering_field('priority')
    ->set_image_path('assets/uploads');
 
$output = $image_crud->render();
 
$this->_example_output($output);
}

Photo gallery with title instant editing

    function example4()
{
$image_crud = new image_CRUD();
 
$image_crud->set_table('example_2');
 
$image_crud->set_primary_key_field('image_id');
$image_crud->set_url_field('url');
$image_crud->set_title_field('title');
$image_crud->set_ordering_field('priority')
        ->set_image_path('assets/uploads');
 
$output = $image_crud->render();
 
$this->_example_output($output);
}