Compare commits
No commits in common. "e2cf30a307950b44700be0f5102ffa28540f384f" and "782c5b4b3892578b220c26fa805be7c0885b28e3" have entirely different histories.
e2cf30a307
...
782c5b4b38
@ -25,7 +25,7 @@ try {
|
|||||||
header("Cache-Control: max-age=86400, public");
|
header("Cache-Control: max-age=86400, public");
|
||||||
echo $image;
|
echo $image;
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
$logger->error($e->getMessage(), ['exception' => $e, 'path' => $imgPath, 'params' => $params]);
|
$logger->error($e->getMessage());
|
||||||
http_response_code(500);
|
http_response_code(500);
|
||||||
echo "Internal Server Error";
|
echo "Internal Server Error";
|
||||||
}
|
}
|
@ -27,21 +27,21 @@ class SqliteImageDb implements ImageDb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function findImage(string $path, ResizeParams $params): Image | null {
|
public function findImage(string $path, ResizeParams $params): Image | null {
|
||||||
$query = 'SELECT * FROM images WHERE path = :path';
|
$query = "SELECT * FROM images WHERE path = :path";
|
||||||
$query .= $params->width ? ' AND width = :width' : ' AND width IS NULL';
|
$query .= $params->width ? " AND width = :width" : " AND width IS NULL";
|
||||||
$query .= $params->height ? ' AND height = :height' : ' AND height IS NULL';
|
$query .= $params->height ? " AND height = :height" : " AND height IS NULL";
|
||||||
$query .= $params->quality ? ' AND quality = :quality' : ' AND quality IS NULL';
|
$query .= $params->quality ? " AND quality = :quality" : " AND quality IS NULL";
|
||||||
|
|
||||||
$stmt = $this->db->prepare($query);
|
$stmt = $this->db->prepare($query);
|
||||||
$stmt->bindParam(':path', $path);
|
$stmt->execute([
|
||||||
if ($params->width !== null) $stmt->bindParam(':width', $params->width);
|
':path' => $path,
|
||||||
if ($params->height !== null) $stmt->bindParam(':height', $params->height);
|
':width' => $params->width,
|
||||||
if ($params->quality !== null) $stmt->bindParam(':quality', $params->quality);
|
':height' => $params->height,
|
||||||
|
':quality' => $params->quality
|
||||||
|
]);
|
||||||
|
|
||||||
$this->logger->info("Querying images", ['query' => $stmt->queryString]);
|
$this->logger->info("Querying images", ['query' => $stmt->queryString]);
|
||||||
|
|
||||||
$stmt->execute();
|
|
||||||
|
|
||||||
$result = $stmt->fetchObject();
|
$result = $stmt->fetchObject();
|
||||||
|
|
||||||
return $result ? Image::fromString(base64_decode($result->content)) : null;
|
return $result ? Image::fromString(base64_decode($result->content)) : null;
|
||||||
|
Loading…
Reference in New Issue
Block a user