Image help

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
Killerkid
Forum Newbie
Posts: 4
Joined: Mon Apr 14, 2008 7:14 pm

Image help

Post by Killerkid »

Hello everybody,
I'm needing help with GD.

This is what the image looks like but I use "imageCreateFromPNG" It makes the image look bad.
It looks like this.
Anyone know how to fix this,
Thanks.
Killerkid
Forum Newbie
Posts: 4
Joined: Mon Apr 14, 2008 7:14 pm

Re: Image help

Post by Killerkid »

Please?
User avatar
markusn00b
Forum Contributor
Posts: 298
Joined: Sat Oct 20, 2007 2:16 pm
Location: York, England

Re: Image help

Post by markusn00b »

How is it possible for us to know the problem without seeing the code you use to create the image?!

Post up, with relevant code tags.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Image help

Post by onion2k »

That's a 24 bit PNG isn't it? You're doing something that wrecks the alpha channel.
Killerkid
Forum Newbie
Posts: 4
Joined: Mon Apr 14, 2008 7:14 pm

Re: Image help

Post by Killerkid »

markusn00b wrote:How is it possible for us to know the problem without seeing the code you use to create the image?!

Post up, with relevant code tags.

Code: Select all

include 'countdown.php';
$count = countdown(4,29,2009);
header("Content-type: image/png");
$string = "Days: " . $count[ 'days' ] . " Hours: " . $count[ 'hours' ] . " Minutes: " . $count[ 'minutes' ] . " Seconds: " . $count[ 'seconds' ] . " to GTA:IV";
$im     = imageCreateFromPNG("http://127.0.0.1/smf/pic/gtaiv.png");
$color  = imagecolorallocate($im, 0, 0, 0);
$px     = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagettftext($im,10,0,$px,20,$color,"ARLRDBD.ttf",$string);
imagepng($im);
imagedestroy($im);
onion2k wrote:That's a 24 bit PNG isn't it? You're doing something that wrecks the alpha channel.
How would I do that?
Killerkid
Forum Newbie
Posts: 4
Joined: Mon Apr 14, 2008 7:14 pm

Re: Image help

Post by Killerkid »

I'm still needing help.
Post Reply