joebudden Posted January 7, 2007 Share Posted January 7, 2007 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 More sharing options...
papaface Posted January 7, 2007 Share Posted January 7, 2007 All you would have to do is find the image in the database and echo it out, like:[code]<?phprequire("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. Link to comment https://forums.phpfreaks.com/topic/33262-displaying-images-from/#findComment-155333 Share on other sites More sharing options...
joebudden Posted January 7, 2007 Author Share Posted January 7, 2007 well the file is stored in the database rather than in a location.how wud i display the image directly from the database???any one care to help please??? Link to comment https://forums.phpfreaks.com/topic/33262-displaying-images-from/#findComment-155343 Share on other sites More sharing options...
papaface Posted January 7, 2007 Share Posted January 7, 2007 ^^ my code does take it from the database. Link to comment https://forums.phpfreaks.com/topic/33262-displaying-images-from/#findComment-155344 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.