|
|
|
@ -42,50 +42,6 @@ class ImageGateway
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function updateName(int $id, string $newName)
|
|
|
|
|
{
|
|
|
|
|
$query = 'UPDATE Image SET nom=:new WHERE id=:i';
|
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
|
':i' => array($id, PDO::PARAM_INT),
|
|
|
|
|
':new' => array($newName, PDO::PARAM_STR)
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function updateDesc(int $id, string $newDesc)
|
|
|
|
|
{
|
|
|
|
|
$query = 'UPDATE Image SET desc=:new WHERE id=:i';
|
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
|
':i' => array($id, PDO::PARAM_INT),
|
|
|
|
|
':new' => array($newDesc, PDO::PARAM_STR)
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function updateTaille(int $id, string $newTaille)
|
|
|
|
|
{
|
|
|
|
|
$query = 'UPDATE Image SET taille=:new WHERE id=:i';
|
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
|
':i' => array($id, PDO::PARAM_INT),
|
|
|
|
|
':new' => array($newTaille, PDO::PARAM_STR)
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function updateType(int $id, string $newType)
|
|
|
|
|
{
|
|
|
|
|
$query = 'UPDATE Image SET type=:new WHERE id=:i';
|
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
|
':i' => array($id, PDO::PARAM_INT),
|
|
|
|
|
':new' => array($newType, PDO::PARAM_STR)
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function updateBlob(int $id, string $newBlob)
|
|
|
|
|
{
|
|
|
|
|
$query = 'UPDATE Image SET blob=:new WHERE id=:i';
|
|
|
|
|
$this->con->executeQuery($query, array(
|
|
|
|
|
':i' => array($id, PDO::PARAM_INT),
|
|
|
|
|
':new' => array($newBlob, PDO::PARAM_STR)
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function delete(int $id)
|
|
|
|
|
{
|
|
|
|
@ -112,7 +68,7 @@ class ImageGateway
|
|
|
|
|
$res = $this->con->getResults();
|
|
|
|
|
$array = [];
|
|
|
|
|
foreach ($res as $r) {
|
|
|
|
|
$array[] = new Image($r['nom'], $r['desc'], $r['taille'], $r['type'], $r['blob']);
|
|
|
|
|
$array[] = new Image($r['nom'], $r['taille'], $r['type'], $r['blob']);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
return $array;
|
|
|
|
|