Jump to content


Problem with image crud

imagecrud

  • Please log in to reply
7 replies to this topic

#1 teoj

teoj

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 21 July 2013 - 10:28 AM

Hellow all im trying do works image crud from a action from 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.goo.../trunk/html5.js"></script><![endif]-->
    <title></title>
    <meta name="keywords" content="" />
    <meta name="description" content="" />
    <link rel="stylesheet" href="http://xxxxx.xx/asse...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/asse...ineuploader.css" />
                    <link type="text/css" rel="stylesheet" href="http://xxxxx.xx/asse...hotogallery.css" />
                    <link type="text/css" rel="stylesheet" href="http://xxxxx.xx/asse...ss/colorbox.css" />
                
          


        
   
<link rel="stylesheet" type="text/css" href="http://xxxxx.xx/asse...otstrap.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/cpan...tos/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/cpan...s/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/cpan...os/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/asse...ry-1.8.2.min.js"></script>
    <script src="http://xxxxx.xx/asse...0.custom.min.js"></script>
    <script src="http://xxxxx.xx/asse...ader-3.2.min.js"></script>
    <script src="http://xxxxx.xx/asse...colorbox-min.js"></script>
     
<script src="http://xxxxx.xx/asse...ootstrap.min.js"></script>
</body>
</html>

 

All files exist and are well linked but when I load the page nothing appears, no upload button or any image. No envargo in the html code generated if everything appears.
Someone can guide me a little or I can say that tool know where the fault.
Thanks in advance

 



#2 davidoster

davidoster

    Grocery CRUD Ninja

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

Posted 21 July 2013 - 10:48 AM

Hello teoj.

You're missing from the view all the js files that are needed!

The js files need to exist on the head of the document.

Check again the original view that comes with Image CRUD,

<!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>

Edited by davidoster, 21 July 2013 - 10:50 AM.
update

____________________________________________________________

 

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

____________________________________________________________

 

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


#3 teoj

teoj

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 21 July 2013 - 11:32 AM



 

Hello teoj.

You're missing from the view all the js files that are needed!

The js files need to exist on the head of the document.

Check again the original view that comes with Image CRUD,

<!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>

Hi davidoster.

The js and css files exist. js files is in the end and css files is in the head on the web. you can see it in the html generate.


Edited by teoj, 21 July 2013 - 11:36 AM.


#4 davidoster

davidoster

    Grocery CRUD Ninja

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

Posted 21 July 2013 - 09:11 PM

js files need to be on the head.


____________________________________________________________

 

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

____________________________________________________________

 

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


#5 teoj

teoj

    Newbie

  • Members
  • Pip
  • 6 posts

Posted 22 July 2013 - 11:24 AM

Thanks davidoster were right, the js had to be in the head. I always put them down.
Now I have another problem that I'm still investigating, when I load an image in the input text for each image I get an error:
Message: Undefined property: stdClass :: $ title
Filename: views / list.php
But this error although I have not looked good. Thanks again.
 
 
Ok now all is working, my table dont has a column title.


#6 Suresh Bhatol

Suresh Bhatol

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 24 July 2013 - 06:28 AM

function example4()
    {
        $image_crud = new image_CRUD();
 
        $image_crud->set_table('ws_example_4');
 
        $image_crud->set_primary_key_field('id');
        $image_crud->set_url_field('url');
        $image_crud->set_title_field('title');
        $target_path = 'assets/uploads/'; if(!is_dir($target_path)){mkdir($target_path);}
        $image_crud->set_ordering_field('priority')
        ->set_image_path($target_path);
 
        $output = $image_crud->render();
 
        $this->load->view("site-admin/index_crud", $output);
    }

Image upload not working.. i tired upload image but show Upload failed



#7 davidoster

davidoster

    Grocery CRUD Ninja

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

Posted 24 July 2013 - 08:27 AM

Hello and welcome to the forums Suresh Bhatol.

Check the permissions of the uploads directory to be 777.

 

Also this line if(!is_dir($target_path)){mkdir($target_path);}

might need the full path.


Edited by davidoster, 24 July 2013 - 08:28 AM.
UPDATE

____________________________________________________________

 

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

____________________________________________________________

 

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


#8 Suresh Bhatol

Suresh Bhatol

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 24 July 2013 - 01:32 PM

function example4()
    {
        $image_crud = new image_CRUD();
 
        $image_crud->set_table('ws_example_4');
 
        $image_crud->set_primary_key_field('id');
        $image_crud->set_url_field('url');
        $image_crud->set_title_field('title');
        $target_path = 'assets/uploads/'; if(!is_dir($target_path)){mkdir($target_path);}
        $image_crud->set_ordering_field('priority')
        ->set_image_path($target_path);
 
        $output = $image_crud->render();
 
        $this->load->view("site-admin/index_crud", $output);
    }

 

Image upload not working.. i tired upload image but show Upload failed







0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users