Advertisement
eduardopaludo

midia.php

Jul 28th, 2014
208
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.87 KB | None | 0 0
  1. public function get_imgs(){
  2.         header('Content-Type: application/x-json; charset=utf-8');
  3.         $this->db->like('nome', $this->input->post('pesquisarimg'));
  4.         if ($this->input->post('pesquisarimg')=='') $this->db->limit(10);
  5.         $this->db->order_by('id', 'DESC');
  6.         $query = $this->midia->get_all();
  7.         $retorno = 'Nenhum resultado encontrado com base em sua pesquisa';
  8.         if ($query->num_rows()>0):
  9.             $retorno = '';
  10.             $query = $query->result();
  11.             foreach ($query as $linha):
  12.                 $retorno .= '<a href="javascript:;" onclick="$(\'.htmleditor\').tinymce().execCommand(\'mceInsertContent\',false,
  13.                 \'<img src='.base_url("uploads/$linha->arquivo").' />\');return false;">';
  14.                 $retorno .= '<img src="'.thumb($linha->arquivo,300,180,FALSE).'" class="retornoimg" alt="'.$linha->nome.'" title="Clique para inserir" /></a>';
  15.             endforeach;
  16.         endif;
  17.         echo (json_encode($retorno));
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement