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");
 }
示例#2
0
 public function alterar(Imagem $img)
 {
     $where = "WHERE " . self::ID . " = '" . $img->getId() . "'";
     $principal = $img->destaque ? self::VALOR_DESTAQUE_TRUE : self::VALOR_DESTAQUE_FALSE;
     $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::DESTAQUE, $principal, $where);
     $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::LEGENDA, $img->legenda, $where);
     $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::SESSAO, $img->getSessao(), $where);
     $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::IDSESSAO, $img->getIdSessao(), $where);
     if ($img->getImage()->nome != '') {
         $img->getImage()->open();
         $this->con->alterar(Sistema::$BDPrefixo . $this->tabela, self::IMAGEM, $img->getImage()->saveImage($this->caminhoEscrita), $where);
     }
 }