public function recuperarImagem($id_imagem){ $query ="SELECT tbl_prova_pergunta_imagem.imagem AS imagem, tbl_prova_pergunta_imagem.prova_pergunta AS pergunta, tbl_prova_pergunta_imagem.descricao AS descricao, tbl_prova_pergunta_imagem.path AS path, tbl_prova_pergunta_imagem.thumb AS thumb FROM tbl_prova_pergunta_imagem WHERE tbl_prova_pergunta_imagem.imagem = ".$id_imagem; $banco = $this->getBancoDados(); $imagem = NULL; $retorno = $banco->executaSQL($query); if($retorno != NULL) { if ($banco->numRows($retorno) == 0){ throw new Exception("Nenhuma imagem encontrado.",0); } while($linha = $banco->fetchArray($retorno)) { $imagem = new Imagem(); $imagem->setId($linha['imagem']); $imagem->setPergunta($linha["pergunta"]); $imagem->setDescricao($linha["descricao"]); $imagem->setPath($linha["path"]); $imagem->setThumb($linha["thumb"]); } return $imagem; } else { throw new Exception("Erro ao recuperar Imagem ($query)"); } }
} else { throw new Exception("Erro no UPLOAD da imagem: ".$handle->error,0); } #Thumb $handle->image_resize = true; $handle->image_ratio_y = true; $handle->image_x = 100; $handle->image_contrast = 10; $handle->jpeg_quality = 70; $handle->file_name_body_add = "_".$perg->getId()."_thumb"; $handle->Process($path_thumb); if ($handle->processed) { $path_thumb = $handle->file_dst_pathname; $obj_imagem->setThumb($path_thumb); #$handle->file_dst_name } else { throw new Exception("Erro no UPLOAD da imagem Thumb: ".$handle->error,0); } $sessionFacade->gravarImagem($obj_imagem); $handle-> Clean(); } } #throw new Exception("teste"); $banco->efetivarTransacao(); header("Location: ".$PHP_SELF."?pergunta=".$perg->getId()."&msg_codigo=1"); exit;