Jump to content


How to use Grocery CRUD and Image CRUD together?

grocery crud image multiple upload

  • Please log in to reply
45 replies to this topic

#1 MarkC

MarkC

    Member

  • Members
  • PipPip
  • 22 posts

Posted 07 February 2013 - 12:46 AM

I'm fascinated of Grocery Crud and how easy is it to work with it. I need to use multiple image gallery upload. There is a table Products with 10-15 columns + 4 n-n relations, and finally I have to  add functionality the user to be able to upload one main image, and 8 images for the gallery.

 

How can I do this with grocery crud and image crud? I don't know where to start and how to make them work together. I imagine there will be some field at the bottom and there should be the images dragged or manually selected with a button click and uploaded...

 

Any help is appreciated.

 

P.S. I don't know if I can open another topic, but I want to make the interface a little more prettier so are there some themes I can choose, or I should create something mine?



#2 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 07 February 2013 - 06:29 AM

Check this out: http://www.grocerycr...-to-work-in-ie/

The whole idea behind it is to use the add_action to the place you need and this will fire-up the image crud library!

 

as for your P.S. grocery crud currently(development version only) supports 3 themes, felxigrid, datatables and twitter-bootstrap(not documented on the documentation yet, http://www.grocerycr...tions/set_theme)


Edited by davidoster, 10 June 2013 - 02:23 PM.
correct for unstable version!

____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#3 MarkC

MarkC

    Member

  • Members
  • PipPip
  • 22 posts

Posted 07 February 2013 - 09:28 AM

Check this out: http://www.grocerycr...-to-work-in-ie/

The whole idea behind it is to use the add_action to the place you need and this will fire-up the image crud library!

 

as for your P.S. grocery crud currently supports 3 themes, felxigrid, datatables and twitter-bootstrap(not documented on the documentation yet, http://www.grocerycr...tions/set_theme)

 

I will need a little help please. I read the first topic you sent me, but there is just that the IE bug was fixed, not a single clue or line of code where and how should I write. I just don't know how to start... Is it possible the image gallery uploading to be in the same view when I'm adding a new product through Grocery CRUD or it has to be separate? The user will have to enter the details for the product, save the product, press go back, find the product in the list and click Add gallery for example? Can this everything be in one single view?

 

P.S. How can use bootstrap theme? I really want to see how it looks like :)



#4 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 07 February 2013 - 12:53 PM

I will try to make an example integrating grocery crud and image crud and I'll post the example, but this will be next week since I am busy!


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#5 MarkC

MarkC

    Member

  • Members
  • PipPip
  • 22 posts

Posted 07 February 2013 - 12:57 PM

I will try to make an example integrating grocery crud and image crud and I'll post the example, but this will be next week since I am busy!

 

Great.



#6 MarkC

MarkC

    Member

  • Members
  • PipPip
  • 22 posts

Posted 07 February 2013 - 01:05 PM

I will try to make an example integrating grocery crud and image crud and I'll post the example, but this will be next week since I am busy!

 

Can you just tell me how to use the Bootstrap theme?



#7 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 07 February 2013 - 01:47 PM

If you check the development version on git hub (line 2 of the change_log.txt) you will see that the bootstrap theme has been implemented om the latest development version(1.4).

Hence you need to download the development version in order to use it. This version is not yet available to the general public and it might contain bugs!!!


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#8 MarkC

MarkC

    Member

  • Members
  • PipPip
  • 22 posts

Posted 07 February 2013 - 02:10 PM

I see. I will wait for the final version. Is there some predictions when is it going to be released?



#9 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 07 February 2013 - 02:39 PM

We don't know!!! I think even web-johnny doesn't know when he will freeze the development of 1.4 and release it!!!


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#10 Antonio Giungato

Antonio Giungato

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 07 February 2013 - 04:33 PM

I'd love to see an example of grocery crud and image crud integration too!



#11 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 955 posts
  • LocationMinsk

Posted 07 February 2013 - 08:29 PM

I seem we need to change the image crud core because it use the same segments which GC use. when I'll have a time I make a library. but I don't know when it will be )

logo.jpg    www.svc.by


#12 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 08 February 2013 - 12:42 AM

I'm fascinated of Grocery Crud and how easy is it to work with it. I need to use multiple image gallery upload. There is a table Products with 10-15 columns + 4 n-n relations, and finally I have to  add functionality the user to be able to upload one main image, and 8 images for the gallery.

 

How can I do this with grocery crud and image crud? I don't know where to start and how to make them work together. I imagine there will be some field at the bottom and there should be the images dragged or manually selected with a button click and uploaded...

 

Any help is appreciated.

 

P.S. I don't know if I can open another topic, but I want to make the interface a little more prettier so are there some themes I can choose, or I should create something mine?

 

MarkC please post the sql of the table products so I can make a real life example.


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#13 MarkC

MarkC

    Member

  • Members
  • PipPip
  • 22 posts

Posted 08 February 2013 - 09:52 AM

Table Products, this is the main table.

 

id 	INT
name 	VARCHAR
company 	TINYINT
code 	INT
date_register 	DATE
date_change 	DATE
main_picture 	VARCHAR
short_description 	VARCHAR
price 	INT
views 	INT
country 	TINYINT
warranty 	TINYINT
stock	BOOLEAN
active	BOOLEAN

I have other tables for 1-N relation, for Countries and Company

 

$crud->set_relation('company', 'companies', 'name_of_company');
$crud->set_relation('country', 'countries', 'name_of_countries');

And I have a few N-N relations

$crud->set_relation_n_n('Categories', 'pr_cat', 'category', 'id_pr', 'id_cat', 'name_cat', 'something');
$crud->set_relation_n_n('Materials', 'pr_mat', 'material', 'id_pr', 'id_mat', 'name_mat');
$crud->set_relation_n_n('Colors', 'pr_col', 'color', 'id_pr', 'id_col', 'name_col');
$crud->set_relation_n_n('Cities', 'pr_city', 'city', 'id_pr', 'id_city', 'name_city');

 

I don't know if I should keep separately Main Picture field, or the first uploaded picture will be the main? I still haven't seen how the Image CRUD works. I plan to add 8 columns more for picture 1-8 in the first table Products and put there the image name. I also want to generate image thumbnails right after the upload, and put them in the appropriate folder.

 

I hope you understand everything I said, I changed the column names in English so you will better understand.



#14 MarkC

MarkC

    Member

  • Members
  • PipPip
  • 22 posts

Posted 08 February 2013 - 10:05 AM

Here is what I have used for another project for the Image thumbnails generate function.

 

function example_callback_after_upload($uploader_response,$field_info, $files_to_upload)
    {
        $this->load->library('image_moo');
             
        //Is only one file uploaded so it ok to use it with $uploader_response[0].
        $file_uploaded = $field_info->upload_path.'/'.$uploader_response[0]->name;
        $new1 = 'pictures/350x210/'.$uploader_response[0]->name;
        $new2 = 'pictures/280x168/'.$uploader_response[0]->name;
        $new3 = 'pictures/196x118/'.$uploader_response[0]->name;
        $new4 = 'pictures/120x72/'.$uploader_response[0]->name;
        $new5 = 'pictures/100x60/'.$uploader_response[0]->name;
     
        $this->image_moo->load($file_uploaded)->set_jpeg_quality(90)
            ->resize(350,210)->save($new1,true)
            ->resize(280,168)->save($new2,true)
            ->resize(196,118)->save($new3,true)
            ->resize(120,72)->save($new4,true)
            ->resize(100,60)->save($new5,true);
     
        return true;
    }


#15 MarkC

MarkC

    Member

  • Members
  • PipPip
  • 22 posts

Posted 10 February 2013 - 09:12 AM

MarkC please post the sql of the table products so I can make a real life example.

 

Hello David,

 

Anything done so far? Or maybe you need more details from me?



#16 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 10 February 2013 - 10:35 AM

MarkC These are quite enough. I have already started trying quite a few things and I want to check what the best solution is. I am trying to do it without modifing any of the core files of either of the two libraries(Grocer/Image Crud) in order for everybody to be able to upgrade the libraries without me needing to change the code I make as an example.

 

The way I do it is by extending the two libraries within the a new controller that binds the two together.

In essence I just make a PHP class that integrates the two of them!

I hope it will work out in the end.

 

But as I said before, next week expect to see some results.

 

 

Hello David,

 

Anything done so far? Or maybe you need more details from me?

 

 

I will try to make an example integrating grocery crud and image crud and I'll post the example, but this will be next week since I am busy!


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#17 MarkC

MarkC

    Member

  • Members
  • PipPip
  • 22 posts

Posted 10 February 2013 - 12:14 PM

MarkC These are quite enough. I have already started trying quite a few things and I want to check what the best solution is. I am trying to do it without modifing any of the core files of either of the two libraries(Grocer/Image Crud) in order for everybody to be able to upgrade the libraries without me needing to change the code I make as an example.

 

The way I do it is by extending the two libraries within the a new controller that binds the two together.

In essence I just make a PHP class that integrates the two of them!

I hope it will work out in the end.

 

But as I said before, next week expect to see some results.

 

Great, I hope there are dozens of people that are waiting for your answer :)



#18 MarkC

MarkC

    Member

  • Members
  • PipPip
  • 22 posts

Posted 13 February 2013 - 08:24 AM

MarkC These are quite enough. I have already started trying quite a few things and I want to check what the best solution is. I am trying to do it without modifing any of the core files of either of the two libraries(Grocer/Image Crud) in order for everybody to be able to upgrade the libraries without me needing to change the code I make as an example.

 

The way I do it is by extending the two libraries within the a new controller that binds the two together.

In essence I just make a PHP class that integrates the two of them!

I hope it will work out in the end.

 

But as I said before, next week expect to see some results.

David, is there anything new? :)



#19 davidoster

davidoster

    Grocery CRUD Ninja

  • Advanced Member
  • PipPipPip
  • 1,068 posts
  • LocationAthens, Greece

Posted 13 February 2013 - 10:47 AM

MarkC there is some progress, check it out here: http://eletter.gr/sa...les/example1_gc

but still long way from complete.


____________________________________________________________

 

rtfm_small.jpg---!!!Please read these guidelines before asking to the forums!!!---

____________________________________________________________

 

David Oster aka George Pasparakis,
http://odphotography.com
http://eletter.gr


#20 MarkC

MarkC

    Member

  • Members
  • PipPip
  • 22 posts

Posted 13 February 2013 - 11:17 AM

I can't get the idea how this will work from this example :) It still won't be in the same form where I'm entering the other product details?

 

I've got another idea, how can I implement some other jQuery Ajax uploader which uploads the images without sending the form, and somehow the image names to be stored in hidden inputs... I don't know if you understand me what I think :)







Also tagged with one or more of these keywords: grocery, crud, image, multiple, upload

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users