画像パスを取得して、tmp ディレクトリ内の対応する画像を fopen しようとしていますが、ページには空の img プレースホルダーの写真しか表示されません。前もって感謝します
public function getImage($path)
{
if($result = $this->db->prepare("SELECT filename FROM trips WHERE filename=?"))
{
$result->bind_param('s', $path);
$result->execute();
$result->bind_result($filename);
if($result->fetch())
{
header("Content-type: image/jpeg");
if(!file_exists("C:/xampp/htdocs/webshop/public/img/content/" . $filename))
{
imagefilter($image, IMG_FILTER_GRAYSCALE);
imagejpeg($image, "C:/xampp/htdocs/webshop/public/img/content/" . $filename);
}
else
{
$image = imagecreatefromjpeg("C:/xampp/htdocs/webshop/public/img/content/" . $filename);
}
imagejpeg($image);
}
else
{
echo "error";
}
}
else
{
echo "Table retrieve failed: (" . $this->db->error . ") " .$this->db->error;
}
var_dump($img);
return $image;
}