Jump to content

SweNuckan

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

SweNuckan's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I decided to use the other method instead. I got it working and it was much easier then my first approach. Thanks for your time and the help, really appreciated. =)
  2. Actually there aint any specific reason. I just followed the instructions from a book, im doing this as a part of a course project.
  3. Hi, Im having some problems with displaying images that are saved in my DB. Ive saved them as mediumblob, the code finds the correct image (ive checked it with outputting the filename) but it wont display it. Firefox tells me something like "The image cant be displayed cause theres something wrong with it" and IE only shows the HTML code and the images binary data. Code: <?php $film = $_GET['filmNr']; // Unique identifier $getmovie = mysqli_query($connection, "SELECT * FROM Film WHERE filmNr='$film'"); if (!$getmovie) { $error = 'Ett fel inträffade under hämtningen av film: ' . mysqli_error($connection); include 'error.inc.php'; exit(); } while ($movie = mysqli_fetch_array($getmovie)) { $movies[] = "<p>Titel: " . $movie['titel'] . "<br />Pris: " . $movie['pris'] . " kronor <br /> Beskrivning: " . $movie['beskrivning']; } if (empty($movies)) { $error = 'Det finns inga sparade filmer. '; include 'error.inc.php'; exit(); } $getimage = mysqli_query($connection, "SELECT * FROM Bild WHERE filmNr='$film'"); $image = mysqli_fetch_array($getimage); $filnamn = $image['filnamn']; // Filename $filtyp = $image['filtyp']; // FIletype $fildata = $image['fildata']; // Filedata $disposition = 'inline'; header("Content-type: $filtyp;"); header("Content-disposition: $disposition; filename=$filnamn"); header('Content-length: ' . strlen($fildata)); foreach ($movies as $movie) { ?> <p> <?php echo $movie; ?> <img src="<?php echo $fildata; ?>" /> </p> <?php } ?> Some help would be appreciated ^^
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.