Jump to content
MakeWebGames

Recommended Posts

Posted

Hello MWG, I am in need of a tad bit of help. I need to create a dynamic image, with text, and the text needs to be able to use HTML. I can only get 2/3 the way with php GD. I can not get html to work in php GD. Example:

 

$info ="<a href=google.com>Google</a>";
$image = imagecreatetruecolor(200, 100);
$black = imagecolorallocate($image, 0x00, 0x00, 0x00); 
$font_file = 'images/arial.ttf'; 
imagettftext($image, 8, 0, 0, 1, $black, $font_file, $info);
header('Content-Type: image/png');
imagepng($image);
imagedestroy($image);
?>

 

That would just return <a href=google.com>Google</a>

Any help? Thanks

Posted

An image is an image, html belongs in a browser.

If you want the image to link to something, you need to link it with image.php.

If you want parts of the image to link to different pages, you can use image maps.

Posted
PHP GD is a fairly hard tool to work with. As stated above HTML is a browser thing with images do not process. An alternative would be to learn flash and PHP.

Good luck -

PHP GD is actualy an easy framework if you have worked with it before.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...