Page 1 of 1

I could use some help...

Posted: Mon Dec 22, 2008 6:25 pm
by maineyak
Hi all,
Now, I'm no coder, that's why I'm here. I have this small script, and I would like to be able to call an image, with html I can included with the image. So calling <img src=myscript.jpg>, which call on myscript.php. I have .htaccess set up like so:

Code: Select all

Redirect myscript.jpg http://www.mydomain.com/myscript.php
That part I know. Here's the script I have:

Code: Select all

<?php
 
define('DS', DIRECTORY_SEPARATOR);
define('WEBROOT', dirname(__FILE__).DS);
 
$image = WEBROOT.'test.jpg';
header('Content-Type: image/jpeg');
header('Content-Length: '.filesize($image));
readfile($image);
 
?>
Now, I have it so it works, and brings up the image. Is there a way I can include html in the php file too, that will show under the image?

I hope I'm making myself clear. I guess it has something to do with the header Content-Type? Is there a way to split it to show html AND image?

Re: I could use some help...

Posted: Tue Dec 23, 2008 2:40 am
by Mark Baker
The answer is no.
Images are pure images, and html text is html.

However, you can actually create or modify an image using PHP that can then be used in a web page.