I could use some help...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
maineyak
Forum Newbie
Posts: 1
Joined: Mon Dec 22, 2008 6:19 pm

I could use some help...

Post 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?
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: I could use some help...

Post 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.
Post Reply