Dynamic Image >>> Writing Text on an 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
User avatar
monkeyj
Forum Commoner
Posts: 82
Joined: Mon Dec 15, 2003 4:32 pm
Location: USA
Contact:

Dynamic Image >>> Writing Text on an image...

Post by monkeyj »

I'm trying to make it whereas I can have an image...
and I can have the LINK to the image be the text written in it...
So far I've got:

Code: Select all

<?php
header("Content-Type: image/PNG");

if (isset($text))&#123;
$blah == $text;
&#125;
else&#123;
$blah == "No text";
&#125; 

$im = ImageCreateFromPNG("bgpic.png"); 
ImageString($im, 2, 90, 19, "$blah", black);
ImagePNG($im);

?>
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

Code: Select all

<?
header("Content-Type: image/PNG");

if (isset($text)){
$blah = $text;    //notice: only one equal sign
}else{
$blah = "No text";   //notice: only one equal sign
}

$im = ImageCreateFromPNG("bgpic.png");
$text_color = imagecolorallocate ($im, 0, 0, 0);
ImageString($im, 2, 90, 19, $blah, $text_color);
ImagePNG($im);

?>
Try that.
User avatar
monkeyj
Forum Commoner
Posts: 82
Joined: Mon Dec 15, 2003 4:32 pm
Location: USA
Contact:

Don't think that quite worked

Post by monkeyj »

I put your code in...
I run it:
http://monkeyblast.com/test1.php?text=BLAHBLADSFLJASDF

but I don't see the text...
User avatar
monkeyj
Forum Commoner
Posts: 82
Joined: Mon Dec 15, 2003 4:32 pm
Location: USA
Contact:

Post by monkeyj »

Nothing Much, i got a working one...
http://monkeyblast.com/test2.php?text=HELLO

Just recentering n stuff now
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

cool, yeah i was going to tell you that you might want to change the coordinates.
Post Reply