AgileLemon
02-28-2007, 03:45 PM
My problem is that instead of treating the code as html it is simply printing it out... is it possible to have HTML inside a generate PHP Image?
<?php
include "includes/config.php";
Header ("Content-type: image/png");
$img_handle = imageCreateFromPNG("images/blank.png");
$color = ImageColorAllocate ($img_handle, 10, 100, 100);
$image = '<img src="images/emo.gif" />';
ImageString ($img_handle, 3, 10, 9, "$image", $color);
ImagePng ($img_handle);
ImageDestroy ($img_handle);
?>
Thanks :)
w3bdesign
02-28-2007, 04:07 PM
If you look at this:
Header ("Content-type: image/png");
You can see that it can ONLY output an image. Not HTML. Not data. Nothing else. If you could tell me a little more about what you need it for, I may more easily understand your intentions here.
Ryan - HostATree
02-28-2007, 05:09 PM
Isnt this exactly what GD does, you just need to use the correct PHP code to do so.
Punj-aab
02-28-2007, 08:00 PM
if you want to retrieve a image in php generated html code you would need another php file to get the image
image.php:-
******************************
<?php
include "includes/config.php";
header("Content-type: image/png");
$img_handle = imageCreateFromPNG("images/blank.png");
$color = ImageColorAllocate ($img_handle, 10, 100, 100);
$image = '<img src="images/emo.gif" />';
ImageString ($img_handle, 3, 10, 9, "$image", $color);
ImagePng ($img_handle);
ImageDestroy ($img_handle);
?>
**************************************
now make a html or php html any thing and where you have the img tag
<img src=image.php>
azizny
02-28-2007, 10:03 PM
Try this:
<?php
include "includes/config.php";
header ("Content-type: image/png");
$img_handle = imageCreateFromPNG("images/blank.png");
$color = ImageColorAllocate ($img_handle, 10, 100, 100);
$image = 'images/emo.gif';
ImageString ($img_handle, 3, 10, 9, $image, $color);
ImagePng ($img_handle);
ImageDestroy ($img_handle);
?>
Peace,