Jump to content


How to use Grocery CRUD and Image CRUD together?

grocery crud image multiple upload

  • Please log in to reply
46 replies to this topic

#41 MSuprayogie KivaHeatnix

MSuprayogie KivaHeatnix

    Member

  • Members
  • PipPip
  • 13 posts

Posted 22 June 2013 - 12:28 AM

in folder grucery crud n image crud . . . paste 2 folder of them ? or grucery crud only @david



#42 davidoster

davidoster

    Grocery CRUD Ninja

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

Posted 22 June 2013 - 12:51 AM

in folder grucery crud n image crud . . . paste 2 folder of them ? or grucery crud only @david

You don't need to copy anything! It already contains both Grocery CRUD and Image CRUD.

Just copy this folder (grocery_image_in_one) to your web server with any name you want.


____________________________________________________________

 

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

____________________________________________________________

 

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


#43 teoj

teoj

    Newbie

  • Members
  • Pip
  • 4 posts

Posted 19 July 2013 - 04:34 PM

Hellow all im trying do works imagecrud and grocery crud, i show you my code:

 

Controller:

 

function view_fotos($id = null)
    {
        $this->load->library('image_crud');
        $image_crud = new image_crud();


        $image_crud->set_table('photos');


       
        $image_crud->set_primary_key_field('id');


        $image_crud->set_url_field('url')
         ->set_image_path('assets/uploads')
         -> set_relation_field('inmueble_ID')
         ->set_title_field('title');


        $output = $image_crud->render();
     // load_plantilla load a template
        $this -> load_plantilla('layout',  $output, 'fotos_view');
    }


function load_plantilla ($layout, $output,  $content)
    {
$this->template
            ->set_partial('head', 'template/head')
            ->set_partial('header', 'template/header')
            ->set_partial('subheader', 'template/subheader')
            ->set_partial('latizq', 'template/latizq')
            ->set_partial('content', $content)
            ->set_partial('subfooter', 'template/subfooter')
            ->set_partial('footer', 'template/footer')
            ->set_partial('foot', 'template/foot')
            ->build($layout, $output);
}
 
and the view is:
 
<?php
echo $output;
?>

 

 

well when i look the code from the google chrome this apear:

 

 

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <!--[if IE]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    <title></title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link rel="stylesheet" href="http://xxxxx.xx/assets/backend/css/cpanel_ifcs.css" type="text/css" media="screen, projection" />
    <!--[if lte IE 6]><link rel="stylesheet" href="http://xxxxx.xx/css/style_ie.css" type="text/css" media="screen, projection" /><![endif]-->
    
                <link type="text/css" rel="stylesheet" href="http://xxxxx.xx/assets/image_crud/css/fineuploader.css" />
                    <link type="text/css" rel="stylesheet" href="http://xxxxx.xx/assets/image_crud/css/photogallery.css" />
                    <link type="text/css" rel="stylesheet" href="http://xxxxx.xx/assets/image_crud/css/colorbox.css" />
                
          


        
    <link rel="stylesheet" type="text/css" href="http://xxxxx.xx/assets/bootstrap/css/bootstrap.min.css" media="screen" />
   
     
    <link href="//netdna.bootstrapcdn.com/font-awesome/3.2.1/css/font-awesome.css" rel="stylesheet">
</head> 
<div class="container-fluid">
  <div class="row-fluid">
    <div class="span2">
           <div id="menu">
       <ul class="nav nav-list">
   <li class="nav-header">teoj.em@gmail.com</li>
  <li class=""><a href="http://xxxxx.xx/cpanel">Panel de Control</a></li>
   <li><a href="http://xxxxx.xx/cpanel/view_pages">Paginas</a></li>
   <li><a href="http://xxxxx.xx/cpanel/view_clientes">Clientes</a></li>
   <li><a href="http://xxxxx.xx/cpanel/view_inmuebles">Inmuebles</a></li>
   <li><a href="http://xxxxx.xx/cpanel/view_alquileres">Alquileres</a></li>
   <li><a href="http://xxxxx.xx/cpanel/view_contactos">Contactos</a></li>
   <li class="divider"></li>
   <li class=""><a href="http://xxxxx.xx/">Inicio</a></li>
   <li><a href="http://xxxxx.xx/auth/logout">Logout</a></li>
</ul>  
      </div>


    </div>
    <div class="span10">
             


<script>
$(function(){
createUploader();
loadColorbox();
});
function loadColorbox()
{
$('.color-box').colorbox({
rel: 'color-box'
});
}
function loadPhotoGallery(){
$.ajax({
url: 'http://xxxxx.xx/cpanel/view_fotos/1/ajax_list',
cache: false,
dataType: 'text',
beforeSend: function()
{
$('.file-upload-messages-container:first').show();
$('.file-upload-message').html("Loading, please wait...");
},
complete: function()
{
$('.file-upload-messages-container').hide();
$('.file-upload-message').html('');
},
success: function(data){
$('#ajax-list').html(data);
loadColorbox();
}
});
}


function createUploader() {
var uploader = new qq.FineUploader({
element: document.getElementById('fine-uploader'),
request: {
endpoint: 'http://xxxxx.xx/cpanel/view_fotos/upload_file/1'
},
validation: {
allowedExtensions: ['jpeg', 'jpg', 'png', 'gif']
}, 
callbacks: {
onComplete: function(id, fileName, responseJSON) {
loadPhotoGallery();
}
},
debug: true,
/*template: '<div class="qq-uploader">' +
'<div class="qq-upload-drop-area"><span>Drop files here to upload</span></div>' +
'<div class="qq-upload-button">Upload files here</div>' +
'<ul class="qq-upload-list"></ul>' +
'</div>',
fileTemplate: '<li>' +
'<span class="qq-upload-file"></span>' +
'<span class="qq-upload-spinner"></span>' +
'<span class="qq-upload-size"></span>' +
'<a class="qq-upload-cancel" href="#">Cancel</a>' +
'<span class="qq-upload-failed-text">Failed</span>' +
'</li>',
*/
});
}


function saveTitle(data_id, data_title)
{
  $.ajax({
url: 'http://xxxxx.xx/cpanel/view_fotos/insert_title',
type: 'post',
data: {primary_key: data_id, value: data_title},
beforeSend: function()
{
$('.file-upload-messages-container:first').show();
$('.file-upload-message').html("Saving title...");
},
complete: function()
{
$('.file-upload-messages-container').hide();
$('.file-upload-message').html('');
}
});
}


window.onload = createUploader;


</script>
<!-- <div id="file-uploader-demo1" class="floatL upload-button-container"></div>
<div class="file-upload-messages-container hidden">
<div class="message-loading"></div>
<div class="file-upload-message"></div>
<div class="clear"></div>
</div>-->
<div id="fine-uploader"></div>
<div class="clear"></div>
<div id='ajax-list'>
</div>    </div>
  </div>
</div>




<script src="http://xxxxx.xx/assets/image_crud/js/jquery-1.8.2.min.js"></script>
    <script src="http://xxxxx.xx/assets/image_crud/js/jquery-ui-1.9.0.custom.min.js"></script>
    <script src="http://xxxxx.xx/assets/image_crud/js/fineuploader-3.2.min.js"></script>
    <script src="http://xxxxx.xx/assets/image_crud/js/jquery.colorbox-min.js"></script>
     
<script src="http://xxxxx.xx/assets/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>

 

 

all the file exist and all apear to works but dont show my nothing. the page is clean only show me the menu. no button and no pictures. Whats the problem thankyou.

 

 



#44 davidoster

davidoster

    Grocery CRUD Ninja

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

Posted 20 July 2013 - 03:23 AM

Hello teoj and welcome to the forums.

You wrote "im trying do works imagecrud and grocery crud" but from your code I only see imagecrud.

Can you please explain what exactly you are trying to do?

I suggest you create a new topic here: http://www.grocerycr.../4-bugs-issues/


____________________________________________________________

 

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

____________________________________________________________

 

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


#45 victor

victor

    grocery CRUD Hero

  • Advanced Member
  • PipPipPip
  • 967 posts
  • LocationMinsk

Posted 30 July 2013 - 09:18 PM

http://www.grocerycr...iple-uploading/

it's not image crud, but it's an example how to make this functionality. 

maybe it's difficult a bit...



#46 Pedro Bernal

Pedro Bernal

    Member

  • Members
  • PipPip
  • 12 posts

Posted 24 January 2014 - 02:29 PM

Hi there I already could implement the davidoster code, and with some modifications in the core I can have two or more images related to the same element, however I have a problem with the reading, I can edit easily but when I am  going to read I got an error, can someone help me with it, because in the davidoster example the read option is disabled and I cant figure it out.

 

Thanks.

 

 

Errors when I click the read option in the list:

 

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: controllers/site.php

Line Number: 126

 

A PHP Error was encountered

Severity: Warning

Message: array_merge(): Argument #2 is not an array

Filename: controllers/site.php

Line Number: 126

 

A PHP Error was encountered

Severity: Warning

Message: Invalid argument supplied for foreach()

Filename: views/gc_example.php

Line Number: 6

 

 controllers/site.php Code:

 
 function hvf()
	{
		$this->g_crud->set_table('hojasvida');
		//$this->g_crud->set_field_upload2('url','assets/uploads');
		$this->g_crud->set_field_upload('imagen1','assets/uploads');
		$this->g_crud->unset_export();
		$this->g_crud->unset_print();
		$this->g_i_crud->unset_upload();
		$this->g_i_crud->unset_delete();
		$this->g_i_crud->set_primary_key_field('sitio');
		//$this->g_i_crud->set_url_field2('url');
		$this->g_i_crud->set_url_field('imagen1');
		$this->g_i_crud->set_table('hojasvida')
		//->set_relation_field('category_id')
		->set_image_path('assets/uploads');
		
		$output = $this->g_crud->render();
		$output2 = $this->g_i_crud->render();
		
		//$output3 = (object)array('output' => $output->output . $output2->output, 'css_files' => array_merge($output->css_files,$output2->css_files), array_merge($output->js_files,$output2->js_files));
		//$this->_gc_output($output3);
		
		$state = $this->g_crud->getState();
		$state_info = $this->g_crud->getStateInfo();
		$t_output = '';
		switch($state)
		{
			case 'add':
			case 'update':
			case 'insert':
			case 'upload':
			case 'upload_file':
			case 'delete':
			case 'delete_file':
			case 'success':
				// use an if($this->ion_auth->is_admin()) for proper user rights
				$t_output = $output;
				break;
			case 'edit':
				$primary_key = $state_info->primary_key;
				// use an if($this->ion_auth->is_admin()) for proper user rights
				$t_output = $output;
				break;
			case 'list':
			default:
				$t_output = (object)array('output' => $output->output . $output2->output, 'js_files' => array_merge($output->js_files,$output2->js_files), 'css_files' => array_merge($output->css_files,$output2->css_files));
				break;
		}
		$this->_gc_output($t_output);
	}

 views/gc_example.php Code:

 
<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8" />
<?php 
foreach($css_files as $file): ?>
	<link type="text/css" rel="stylesheet" href="<?php echo $file; ?>" />
<?php endforeach; ?>
<?php foreach($js_files as $file): ?>
	<script src="<?php echo $file; ?>"></script>
<?php endforeach; ?>
<style type='text/css'>
body
{
	font-family: Arial;
	font-size: 14px;
}
a {
    color: blue;
    text-decoration: none;
    font-size: 14px;
}
a:hover
{
	text-decoration: underline;
}
</style>
</head>


#47 cybersven

cybersven

    Newbie

  • Members
  • Pip
  • 8 posts

Posted 27 March 2017 - 12:36 PM

All the links are dead, someone got the files or can explain how to do it ?







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