public function inserir(Imagem $img) { if ($this->getTotal() > 0) { end($this->imagens); $name = current($this->imagens); $num = explode($img->getIdSessao() . "_", $name); $num2 = explode(".jpg", $num[1]); } else { $num2[0] = 0; } $numero = (int) $num2[0] + 1; $img->getImage()->open(); $img->getImage()->saveImage($this->dir, $img->getIdSessao() . "_" . $numero, "jpg"); }
$javaScript .= Aviso::criar("Produto salvo com sucesso!"); } else { $javaScript .= Aviso::criar($erro); } } $p = $lP->condicoes('', $_GET['produto'], ListaProdutos::ID)->disableDadosProdutoPai()->listar(); if (isset($_GET['uploadFlash'])) { $con = BDConexao::__Abrir(); $con->executar("SELECT * FROM " . Sistema::$BDPrefixo . "marcadagua"); $rs = $con->getRegistro(); $img = new Imagem(); $img->setSessao($lP->getTabela(), $p->getId()); $arq = Arquivos::__OpenArquivoByTEMP($_FILES['Filedata']); //header("Content-type: image/jpeg"); $img->setImage(new Image($arq)); $img->getImage()->open(); //echo $img->getImage()->getImage();exit; if ($rs['produtos']) { if ($rs['tipo'] == 1) { if (!empty($rs['texto'])) { $ma = new NewImage(strlen($rs['texto']) * 9, 20); $ma->writeText($rs['texto']); } } elseif ($rs['tipo'] == 2) { if (!empty($rs['imagem'])) { $ma = new Image(new Arquivos(Sistema::$caminhoURL . Sistema::$caminhoDataIdiomas . $rs['imagem'])); $ma->open(); //echo $ma->getImage();exit; } } if ($ma) {
public function deletar(Imagem $img) { $where = "WHERE " . self::ID . " = '" . $img->getId() . "'"; Arquivos::__DeleteArquivo($this->caminhoEscrita . $img->getImage()->nome . '.' . $img->getImage()->extensao); $this->con->deletar(Sistema::$BDPrefixo . $this->tabela, $where); }