note 45027 added to function.imagepng

From: Date: Mon, 23 Aug 2004 20:43:51 +0000
Subject: note 45027 added to function.imagepng
Groups: php.notes 
Request: Send a blank email to php-notes+get-75179@lists.php.net to get a copy of this message
in reply to: cbrasho at yahoo dot com if you use Apache as a webserver, you could do the following: You could set up a 'img' directory in your webspace. In that directory there will be two files: a .htaccess file and a img.php file the .htaccess file contains the following code: ErrorDocument 404 /img/img.php the img.php file looks something like this: <?php $file = $_SERVER['REDIRECT_URL']; $result = mysql_query('select img_blob from images where filename=\\'' . $file . '\\'); list($blob) = mysql_fetch_row($result); header('HTTP/1.0 200 Ok'); header("Content-type: image/jpeg"); print $blob; # or whatever works, I don't use this ?> if you use a url for your image like http://test.com/img/image1.jpeg, which doesn't exist, normally you would get a 404-page. in this case, the 404 is being handled by img.php, which brings up the required image... ---- Manual Page -- http://www.php.net/manual/en/function.imagepng.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+45027 Delete -- http://master.php.net/manage/user-notes.php?action=delete+45027&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+45027&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#75179) next »