note 47308 added to function.imagepng

From: Date: Wed, 10 Nov 2004 22:08:30 +0000
Subject: note 47308 added to function.imagepng
Groups: php.notes 
Request: Send a blank email to php-notes+get-80376@lists.php.net to get a copy of this message
To cbrasho at yahoo dot com I don't get the problem. If you want to have images stored as blobs, you can do a show.php like this: <?php //get file ID $id = $_REQUEST['id']; //get data from blob $sql = "SELECT Data, Type, Extension FROM Images WHERE ID=$id"; $records=mysql_query($sql); $record=mysql_fetch_row($records); $data=$record['Data']; $type=$record['Type']; $ext=$record['Extension']; //output data header("Content-Type: $type"); header("Content-Disposition: inline; filename=img$id.$ext"); echo $data; ?> I've done this many times (conceptually), and it works like a charm, although I would recommend a little more security on that indata. If you have a unified place images go in (like an upload form), you can even drop the type and extension part by saving every image as the same filetype. ---- Manual Page -- http://www.php.net/manual/en/function.imagepng.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+47308 Delete -- http://master.php.net/manage/user-notes.php?action=delete+47308&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+47308&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+47308&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+47308&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+47308&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+47308&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+47308&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#80376) next »