0
I need a code that when I click on the image, this image will open in a new tab. So far I have managed to make that when I click on my image it opens another tab with the image path in the URL. How do I take this path that is in the URL and make the image appear on my page, and my code is in Codeigniter and MVC. This image is saved in my database.
The code I’m using to open the image is:
function abreFoto(){
window.open('<?= base_url('ControllerL/verFoto' + $l->foto_caminho ,'_blank'); ?>');
}
my controller:
public function verFoto($id) {
$data['id'] = $id;
$data['foto'] = $this->ML->getFoto($id);
$this->load->view('ViewFoto', $data);
}
my Model:
public function getFoto($id) {
$this->db->select('fots.foto_id, fots.foto_caminho, laus.Laudo_id');
$this->db->from('fots');
$this->db->where('laus.Laudo_id', $id);
$q = $this->db->get();
return $q->result();
}