i need it also.
i don't know how to use image crud with add action ?
can any one show me please?
⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠
Posted 13 February 2013 - 13:29 PM
i need it also.
i don't know how to use image crud with add action ?
can any one show me please?
Posted 14 February 2013 - 07:18 AM
hi i used it with add action successfully .
but i have question:
how can i determine the image extensions (jpg ,png,....).
and how can i use callback_before_delete & set_language functions?
Posted 14 February 2013 - 08:15 AM
any help??
Posted 14 February 2013 - 08:33 AM
hi i used it with add action successfully .
but i have question:
how can i determine the image extensions (jpg ,png,....).
and how can i use callback_before_delete & set_language functions?
Can you show me how you did that? Maybe I would be able to solve the rest...
Posted 14 February 2013 - 08:37 AM
OK her it's
function management() { $crud = new grocery_CRUD(); $crud->set_table('photos'); $crud->columns('Name','Category_ID','Image'); $crud->set_field_upload('Image', 'assets/uploads/thumb/'); $crud->add_action('more_images', base_url().'assets/template/images/add_image.png', '' ,'ui-icon-plus',array($this,'gallery')); $output = $crud->render(); $this->_output_data($output); } public function gallery($primary_key , $row) { return site_url('Admin/image/management/'.$row->Category_ID); }
image/management
function management() { $c = new image_CRUD(); $c->set_table('photos'); //-- Set the table name of photo gallery $c->set_primary_key_field('ID'); $c->set_url_field('Image'); //--Set the url field name that you want to store the image name $c->set_ordering_field('ID'); //--set the table field that is responsible for the ordering. $c->set_image_path('assets/uploads/thumb'); $c->set_relation_field('Category_ID'); //$c->set_language(lang('Adminlang')); $output = $c->render(); $this->_output_data($output); }
Posted 14 February 2013 - 10:28 AM
Dear fellow developers, it seems that I don't have enough time to play around with this issue.
The following dropbox link contains a 7zipped file with the installation as it stands now on: http://eletter.gr/samples/gc_ic2
Under application/controllers/ open the gc_examples.php controller and the function example1_gc.
In this function we have a full integration of grocery crud/image crud together at the same time on the same view, as it is showed here, http://eletter.gr/samples/gc_ic2/index.php/gc_examples/example1_gc
For your information, the integrity of the two libraries, grocery crud and image crud remains intact, this means that no changes to the core files have been made.
The only change that has taken place is on the list.php view of the image crud, assets/image_crud/views/list.php where
lines 5,6 have been commented out,
As I have explained on a previous post the idea is not to change anything on the libraries themselves and have both grocery and image crud at the same time together.
For example, if a site viewer browses the gallery (not logged in as an administrator) can see something like the simple gallery (http://eletter.gr/samples/gc_ic2/index.php/gc_examples/simple_photo_gallery)
If he logs in as an administrator then he can have the full view as it stands right now on : http://eletter.gr/samples/gc_ic2/index.php/gc_examples/example1_gc
If somebody has time, he could extend it in a way that the main db holds more information like albums(another table), or even users' albums in a multiuser environment.
The available options are endless to be honest!
So here is the link:
https://dl.dropbox.com/u/37325099/grocery_image_in_one.7z
P.S. on the root there is the gz file from phpmyadmin in order to setup your database, samples_gc_ic.sql.gz
I hope this helps somebody! Good luck.
UPDATE: Using the attached code and the ability of image crud to multiple upload then we can have a fully featured album/gallery to be used by anyone in any environment, even if it is single or multi user environment (by using the suggested as I mentioned before).
hi i used it with add action successfully .
but i have question:
how can i determine the image extensions (jpg ,png,....).
and how can i use callback_before_delete & set_language functions?
OK her it's
function management() { $crud = new grocery_CRUD(); $crud->set_table('photos'); $crud->columns('Name','Category_ID','Image'); $crud->set_field_upload('Image', 'assets/uploads/thumb/'); $crud->add_action('more_images', base_url().'assets/template/images/add_image.png', '' ,'ui-icon-plus',array($this,'gallery')); $output = $crud->render(); $this->_output_data($output); } public function gallery($primary_key , $row) { return site_url('Admin/image/management/'.$row->Category_ID); }image/management
function management() { $c = new image_CRUD(); $c->set_table('photos'); //-- Set the table name of photo gallery $c->set_primary_key_field('ID'); $c->set_url_field('Image'); //--Set the url field name that you want to store the image name $c->set_ordering_field('ID'); //--set the table field that is responsible for the ordering. $c->set_image_path('assets/uploads/thumb'); $c->set_relation_field('Category_ID'); //$c->set_language(lang('Adminlang')); $output = $c->render(); $this->_output_data($output); }
Can you show me how you did that? Maybe I would be able to solve the rest...
Posted 14 February 2013 - 10:39 AM
To limit Grocery's permitted files you need to go under application/config/grocery_crud.php
To limit Image's you need to change the core library file under applications/libraries/image_crud.php in a couple of places,
1. protected function _upload_file($upload_dir)
2. private function trim_file_name($name, $type)
Posted 14 February 2013 - 12:07 PM
Thank you very much David!
Posted 14 February 2013 - 13:57 PM
Dear fellow developers, it seems that I don't have enough time to play around with this issue.
The following dropbox link contains a 7zipped file with the installation as it stands now on: http://eletter.gr/samples/gc_ic2
Under application/controllers/ open the gc_examples.php controller and the function example1_gc.
In this function we have a full integration of grocery crud/image crud together at the same time on the same view, as it is showed here, http://eletter.gr/samples/gc_ic2/index.php/gc_examples/example1_gc
For your information, the integrity of the two libraries, grocery crud and image crud remains intact, this means that no changes to the core files have been made.
The only change that has taken place is on the list.php view of the image crud, assets/image_crud/views/list.php where
lines 5,6 have been commented out,
//$this->set_js('assets/image_crud/js/jquery-1.8.2.min.js');//$this->set_js('assets/image_crud/js/jquery-ui-1.9.0.custom.min.js');I hope somebody can take it from there and carry on!As I have explained on a previous post the idea is not to change anything on the libraries themselves and have both grocery and image crud at the same time together.
For example, if a site viewer browses the gallery (not logged in as an administrator) can see something like the simple gallery (http://eletter.gr/samples/gc_ic2/index.php/gc_examples/simple_photo_gallery)
If he logs in as an administrator then he can have the full view as it stands right now on : http://eletter.gr/samples/gc_ic2/index.php/gc_examples/example1_gc
If somebody has time, he could extend it in a way that the main db holds more information like albums(another table), or even users' albums in a multiuser environment.
The available options are endless to be honest!
So here is the link:
https://dl.dropbox.com/u/37325099/grocery_image_in_one.7z
P.S. on the root there is the gz file from phpmyadmin in order to setup your database, samples_gc_ic.sql.gz
I hope this helps somebody! Good luck.
UPDATE: Using the attached code and the ability of image crud to multiple upload then we can have a fully featured album/gallery to be used by anyone in any environment, even if it is single or multi user environment (by using the suggested as I mentioned before).
Hello David,
Can you just show me where to click to see how uploading of images works?
Posted 14 February 2013 - 14:28 PM
Sorry guys!!! I forgot to change the language interface of the library! It's english now!
Posted 16 February 2013 - 13:20 PM
i use it but it makes some errors,
so i returned back to add_action case.
but there is a problem ,
h want to make 2 conditions (how it come).
i.e.
like that
function management() { $c = new image_CRUD(); $c->set_table('photos'); $c->set_primary_key_field('ID'); $c->set_url_field('Image'); // $c->set_title_field('title'); $c->set_ordering_field('ID'); $c->set_image_path('assets/uploads'); $c->set_relation_field('Category_ID'); $c->set_relation_field('Year''); $output = $c->render(); $this->_output_data($output); }
i know it's wrong to use
$c->set_relation_field('Category_ID');
but i want to make another condition.
any help??
Posted 19 February 2013 - 00:52 AM
I really didn't get this to work.
I have another question. Can this plugin jQuery File Upload integrate somehow with grocery crud?
http://blueimp.github.com/jQuery-File-Upload/
Posted 21 February 2013 - 21:03 PM
Hi, this is my working solution:
- In the add and edit files, put an iframe that points your image-crud part, just over the save/cancel buttons or wherever you want to manage the images.
- You can adapt the iframe's height as you add or delete rows of images, calling a js function declared outside the iframe, from inside the iframe ( parent.myResizeFunction() ) in two situations: <body onload="parent.myResizeFunction()... and every time image list is updated (/assets/image_crud/views/list.php about line 36, on "complete" function)
As there's a 1-n relation between the table record and the images we set $image_crud->set_relation_field('myField');. The value of this field is passed to the image crud in the url (see example_3). But when we are adding a new record we still don't have this value, so I'm using a very high value like 99999 as a temporary value. When saving new record, I use a callback_after_insert which second parameter gives me the new insert_id, then I update the temporary value in my images table.
When editing a record, get the current ID from $this->getStateInfo(); to compose the iframe's source url.
This solution doesn't change any core file. I don't like using iframes and functions calling iframe's parent... but it's easy to implement and it does the job.
Posted 21 February 2013 - 22:18 PM
This is nice!
Another way of doing it.
Could you share an example code?
Hi, this is my working solution:
- In the add and edit files, put an iframe that points your image-crud part, just over the save/cancel buttons or wherever you want to manage the images.
- You can adapt the iframe's height as you add or delete rows of images, calling a js function declared outside the iframe, from inside the iframe ( parent.myResizeFunction() ) in two situations: <body onload="parent.myResizeFunction()... and every time image list is updated (/assets/image_crud/views/list.php about line 36, on "complete" function)
As there's a 1-n relation between the table record and the images we set $image_crud->set_relation_field('myField');. The value of this field is passed to the image crud in the url (see example_3). But when we are adding a new record we still don't have this value, so I'm using a very high value like 99999 as a temporary value. When saving new record, I use a callback_after_insert which second parameter gives me the new insert_id, then I update the temporary value in my images table.
When editing a record, get the current ID from $this->getStateInfo(); to compose the iframe's source url.
This solution doesn't change any core file. I don't like using iframes and functions calling iframe's parent... but it's easy to implement and it does the job.
Posted 10 June 2013 - 10:46 AM
Hi, this is my working solution:
- In the add and edit files, put an iframe that points your image-crud part, just over the save/cancel buttons or wherever you want to manage the images.
- You can adapt the iframe's height as you add or delete rows of images, calling a js function declared outside the iframe, from inside the iframe ( parent.myResizeFunction() ) in two situations: <body onload="parent.myResizeFunction()... and every time image list is updated (/assets/image_crud/views/list.php about line 36, on "complete" function)
As there's a 1-n relation between the table record and the images we set $image_crud->set_relation_field('myField');. The value of this field is passed to the image crud in the url (see example_3). But when we are adding a new record we still don't have this value, so I'm using a very high value like 99999 as a temporary value. When saving new record, I use a callback_after_insert which second parameter gives me the new insert_id, then I update the temporary value in my images table.
When editing a record, get the current ID from $this->getStateInfo(); to compose the iframe's source url.
This solution doesn't change any core file. I don't like using iframes and functions calling iframe's parent... but it's easy to implement and it does the job.
can you post the code for us to see i need to use this to
Posted 17 June 2013 - 19:46 PM
I'm Confused with function set_relation_n_n();
please....help me.....to Explain..... :D :D :D :D
Posted 19 June 2013 - 22:10 PM
I'm Confused with function set_relation_n_n();
please....help me.....to Explain..... :D :D :D :D
The example is quite self explanatory. Study it along with the code and make some examples of yourself to see what happens.
Posted 21 June 2013 - 03:20 AM
Posted 21 June 2013 - 23:41 PM
Posted 21 June 2013 - 23:44 PM
Dear fellow developers, it seems that I don't have enough time to play around with this issue.
The following dropbox link contains a 7zipped file with the installation as it stands now on: http://eletter.gr/samples/gc_ic2
Under application/controllers/ open the gc_examples.php controller and the function example1_gc.
In this function we have a full integration of grocery crud/image crud together at the same time on the same view, as it is showed here, http://eletter.gr/samples/gc_ic2/index.php/gc_examples/example1_gc
For your information, the integrity of the two libraries, grocery crud and image crud remains intact, this means that no changes to the core files have been made.
The only change that has taken place is on the list.php view of the image crud, assets/image_crud/views/list.php where
lines 5,6 have been commented out,
//$this->set_js('assets/image_crud/js/jquery-1.8.2.min.js');//$this->set_js('assets/image_crud/js/jquery-ui-1.9.0.custom.min.js');I hope somebody can take it from there and carry on!As I have explained on a previous post the idea is not to change anything on the libraries themselves and have both grocery and image crud at the same time together.
For example, if a site viewer browses the gallery (not logged in as an administrator) can see something like the simple gallery (http://eletter.gr/samples/gc_ic2/index.php/gc_examples/simple_photo_gallery)
If he logs in as an administrator then he can have the full view as it stands right now on : http://eletter.gr/samples/gc_ic2/index.php/gc_examples/example1_gc
If somebody has time, he could extend it in a way that the main db holds more information like albums(another table), or even users' albums in a multiuser environment.
The available options are endless to be honest!
So here is the link:
https://dl.dropbox.com/u/37325099/grocery_image_in_one.7z
P.S. on the root there is the gz file from phpmyadmin in order to setup your database, samples_gc_ic.sql.gz
I hope this helps somebody! Good luck.
UPDATE: Using the attached code and the ability of image crud to multiple upload then we can have a fully featured album/gallery to be used by anyone in any environment, even if it is single or multi user environment (by using the suggested as I mentioned before).