Forum Moderators: coopster

Message Too Old, No Replies

php image include

         

taheca

3:02 pm on Jul 24, 2010 (gmt 0)

10+ Year Member



Hi,

I'm calling the content of my website via PHP include:

<?php include("inc/content.php") ;?>


My inc/content.php looks like this:
<?php
if(isset($_GET['section']) AND isset($dateien[$_GET['section']])) {
include $dateien[$_GET['section']];
} else {
include $dateien['home'];
}
?>


Then the content gets grabbed over a config.php:
<?php 
$dateien = array();
$dateien['home'] = "inc/home.htm";
$dateien['test'] = "inc/test.htm";
?>


Question, how can I do that with an header image?

I want to create a folder /inc/banner/ and place in it all header images:
home.png
test.png

Now obviously I can't just do it the same as with the content since a...
<?php include("inc/banner.php") ;?>


... by using...
$banner = array();
$banner['home'] = "inc/banner/home.png";

... wouldn't parse an image.

How can I include the images accordingly like the content?

Thank you very much in advance.

~taheca

Readie

3:45 pm on Jul 24, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



$banner['home'] = "inc/banner/home.png";

... wouldn't parse an image.

Not really true, you could use the header() function to change the output type to png like:

header("Content-type:image/png");

Then, rather than using an include function, you can point an img tag at the php file:

<img src="/my/image/file.php">