Display picture not download

Hi guys

I have this section on my success page that shows the contents of my DB on the page and has the files linked to download.php, instead of having the file download, is it possible to display the jpg instead?

Here is the code from the success page (first page after login)

[php]

<?PHP echo '

Customers Pictures

'; // get the files belonging to the logged in user $result = mysql_query('SELECT upid, name, size FROM gallery WHERE username=\''.mysql_real_escape_string($_SESSION['MM_Username']).'\''); // check query did execute without errors if($result) { // output each file while($row = mysql_fetch_assoc($result)) { echo ''.$row['name'].'
'; } // query did not execute, log or show error message } else { trigger_error('Cannot get users files from database: ' . mysql_error()); } ?>

[/php]

and here is the download.php

[php]

<?php require_once('/Connections/new.php'); ?> <?php session_start(); // very basic check to see if user is logged in if(!isset($_SESSION['MM_Username'])) { // kill the script display warning. die('Unauthorised accessed. You must be logged in to access this file'); } // Has a file id been passed? if(isset($_GET['upid']) && ctype_digit($_GET['upid'])) { // fetch the file where the upid matches $result = mysql_query('SELECT name, type, size, content FROM upload WHERE upid='.intval($_GET['upid'])); // query executed ok if($result) { // get the files details list($name, $type, $size, $content) = mysql_fetch_row($result); // present file for download header("Content-length: $size"); header("Content-type: $type"); header("Content-Disposition: attachment; name=$name"); echo $content; exit; } } ?>

[/php]

The success page displays the file name with a hyperlink which when clicked on, downloads the file. Instead of having it download, I just want it to display the picture?

If you have an endpoint url where the image is displayed, you can put that url in your image tag:

<img style="height:40px;width:40px" alt="fred's picture" src="/phpimagecode.php?id=fred" />
Sponsor our Newsletter | Privacy Policy | Terms of Service