[eluser]mostafash[/eluser]
Hi,
I'm using Redactor editor on my project.
I want to load images from my folder to editor .This editor using json encode to call image thumb path and image path.
I use below code to show images in my editor but the editor didn't load any images:
in view page I use this code:
Code:
[removed]
$(document).ready(
function()
{
$('#description').redactor({
imageUpload: 'modul/editor_uploader.php',
imageGetJson: '<?php echo $editor_images; ?>',
lang : 'fa',
direction: 'rtl',
});
}
);
[removed]
and I use this in my model:
Code:
var $gallery_path;
var $gallery_url;
var $images_path;
var $images_url;
public function __construct (){
parent::__construct();
$this->images_path=realpath(APPPATH.'../uploads/images');
$this->images_url=base_url().'uploads/images/';
$this->gallery_path=realpath(APPPATH.'../uploads/gallery');
$this->gallery_url=base_url().'uploads/gallery/';
}
public function get_editor_images(){
$files=scandir($this->images_path);
$files=array_diff($files,array('.','..','thumbs','index.html'));
$images=array();
foreach($files as $file){
$images[]=array(
'thumb' => $this->images_url.'thumbs/'.$file,
'image' => $this->images_url.$file
);
}
return stripslashes(json_encode($images));
}
and use this in controller:
Code:
$data['editor_images']=$this->File_model->get_editor_images();
But I can't see any images in my editor .
Can any one help me,plz