PHP 8.5.0 Alpha 4 available for testing

Voting

: eight plus one?
(Example: nine)

The Note You're Voting On

pm at dontspamme dot pietmarcus dot com
20 years ago
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...

<< Back to user notes page

To Top