poster format in blob

Asked by markus eder

Hi, I'm trying to read the poster data with a php script to retrieve informations using a small php script. I need to know the format (ipeg, png, tiff....) to use the correct
header('Content-Type: image/gif');
settings. Once it's working I can also distribute it. I use it to check my available Videos via my HP-Touchpad and a Webserver on my NAS.

Question information

Language:
English Edit question
Status:
Solved
For:
Griffith Edit question
Assignee:
No assignee Edit question
Solved by:
markus eder
Solved:
Last query:
Last reply:
Revision history for this message
Michael (mikej06) said :
#1

Griffith doesn't provide the filetype directly with a database field.
You should try to use the fileinfo api of the PECL extensions:
http://www.php.net/manual/de/ref.fileinfo.php

Revision history for this message
markus eder (markus-eder) said :
#2

Thx for the hint but during my investigations how to install/use PECL extension I found my solution. covers.data contains a jpeg file. Here my code maybe somone has the same issues.

executing in a php script:

echo "<img src='Bild_Anzeigen.php?mdparam=$postermd'>";

Bild_Anzeigen.php:
<?php
// Posterausgabe md5
  $md5param = $_GET['mdparam'];
   // Datenbank-Datei offnen bzw. erzeugen
    $db = new PDO("sqlite:C:\Temp\griffith.db");
  // Abfrage ausfuehren
        $dbPosters = $db->prepare("SELECT * from posters where md5sum= :MD5nr");
        $dbPosters->bindParam('MD5nr', $eingabe);
        $eingabe = $md5param;
  $dbPosters->execute();
   // Abfrage-Ergebnis ausgeben
   foreach($dbPosters as $row)
 {
    $md5Wert = $row[0];
    $Poster = $row[1];
      $image=imagecreatefromstring($Poster);
  Header("Content-type: image/jpg");
  imagejpeg($image);
 }
?>