can't get my headers and footers working with my image :(

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
mike08
Forum Commoner
Posts: 57
Joined: Mon Apr 19, 2004 3:18 am

can't get my headers and footers working with my image :(

Post by mike08 »

any ideas

i have this code at the bottom of my show_poll.php page



PHP:
--------------------------------------------------------------------------------

<?
ob_start();
Header('Content-type: image/png');
ImagePng($im);
ImageDestroy($im);
include ('../includes/header.html');
include ('../includes/footer.html');
ob_end_flush();
?>

--------------------------------------------------------------------------------



but only can see the graph for making my online poll and can't see any of the header or footer files, wondered if someone could help
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

Maybe taking them out of the ob_ functions...?
User avatar
tim
DevNet Resident
Posts: 1165
Joined: Thu Feb 12, 2004 7:19 pm
Location: ohio

Post by tim »

mike - I will hit you before the admins/mods do cause i'm sure my version will be more nice.

Do not flood the boards with the same question. Find one category n post one question!

read the rules/abide by them if you wish to get help, sheesh!
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

NO reason to multi post....
mike08
Forum Commoner
Posts: 57
Joined: Mon Apr 19, 2004 3:18 am

Post by mike08 »

apologies.

haven't read the rules :(
User avatar
PrObLeM
Forum Contributor
Posts: 418
Joined: Sun Mar 07, 2004 2:30 pm
Location: Mesa, AZ
Contact:

Post by PrObLeM »

I don’t want to sound mean or anything but....

You have 42 posts... come on

ok regardless if you haven’t read the rules or not, its common curtsies not to do that.

just next time think before you post something like that


Now you know and knowing is half the battle...
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Try:

Code: Select all

<?
ob_start();
Header('Content-type: image/png');
ImagePng($im);
ImageDestroy($im);
ob_end_flush();
?>
The problem is you were trying to mix .html stuff with the image. That's not what you want. If you want to include an image in an HTML file, you use an img tag like this

Code: Select all

&lt;img src="path/to/imagescript.php" /&gt;
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

JAM from other thread wrote:

Code: Select all

<?php
// image.php is holding the header() and other info of the above picture
include ('../includes/header.html');
?>
<img src="image.php">
<?php
include ('../includes/footer.html');
?>
Dont bother Jason, this user cannot test something that is allready bounced as idea to him.
mike08
Forum Commoner
Posts: 57
Joined: Mon Apr 19, 2004 3:18 am

cheers!

Post by mike08 »

Thanks ever so much Jam and jason - your magicians. Ive been struggling with that for days. - works like a gem now though.


sorry im not very good at this programming lark. :(
Post Reply