Jump to content

displaying images from


joebudden

Recommended Posts

Hi all, I've created an upload script, which inserts the files into a mysql database.

If the file is an image i want it to be displayed on the page, within the browser.

I've been reading about displaying a thumbnail of the image, using GD library but dont really understand it..

I firstly want to implement code to display the actual image on my view uploads page and go from there.

how can this be achieved ???

any ideas guys ???
Link to comment
https://forums.phpfreaks.com/topic/33262-displaying-images-from/
Share on other sites

All you would have to do is find the image in the database and echo it out, like:
[code]<?php
require("connect.php");
require("dbselect.php");

$selectfrmdb = "select name,type,size,upload "."from uploads where upID='".$_GET['id']."'";

$result = mysql_query($selectfrmdb,$con)or die('Error, query failed');

list($name,$type,$size,$upload) = mysql_fetch_array($result);

header("Content-length: $size");
header('Content-type: $type');
echo $upload;


mysql_close($con);
exit;
?>[/code]
$upload is the actual image.
In the above I use an id in the URL to find the image I want.
P.S I know this works as i use it in my script.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.