![]() |
GD library... Oh god the errors...
PHP Code:
It creates an image with the following error: Parse error: parse error, unexpected T_STRING in C:\wamp\www\Lessons\GD\GD, The basics.php on line 9 Line 9 is the one with hello world, hello world is the string. |
I seriously do not know a lot of GD Libary. I know from experience that Dale is the meistro when it comes down to GD. (Rendair is his nick on the forum)
Simply debuggin this as I go so bare with me. Ehm lol, on second notice, when you engage a header(), you can never and I mean NEVER have a output before the header(). I believe this is what you got from php.net; PHP Code:
:: edit :: Oh yeah, instead of $sring I should try $string. :-) PHP Code:
PHP Code:
|
I saved over my old version before I saw your edit, I will check that out later. Right now I am having another issue, and I don't understand waht it could be.
PHP Code:
Why is it that line 5 will change the image even when it is stored in a variable? Do certain functions in PHP do something when they are stored? |
If you're using firefox it can be displaying an url because there's something wrong with the image.. Try commenting out the header part to check for php errors..
|
Quote:
|
You don't need
$string in there. There is no need to capture the return value from imagestring into a variable, and certainly no need to use that variable as the filename argument when calling imagegif. |
You can also check out "The Big GD Guide - Part 1" in Salathe sig. ;-)
|
Quote:
|
All you need is
PHP Code:
|
Quote:
|
A friendly advice. Don't ever do this again:
Code:
header("Content-type: image/png"); If you send a header for a specific content-type, then, for god's sake, continue outputting that format. Don't send out a png header and output a JPEG image. It's wrong. |
The GD article didn't say that :( It wasn't until I looked at the PHP documentation and saw all the functions that I saw that you could change all that stuff.
edit: Yet another code that doesn't seem to work... Why does GD have to be so complicated? PHP Code:
|
What exactly doesn't work? I, myself, thought at some point that GD was so god damn hard. But then I delved into it, and using just the php.net reference I was able to create a captcha system of my own (a very basic one, but it worked). So it isn't that hard. After that, more followed (like a simple graph system, some statistics generators and even an image manipulation library). You just need to get the point. And practice :-P
|
The code works now, It saved as a PNG by default...
Why use imagetruecolor instead of imagecreate? :/ This stuff is confuzzling the me. Can somone help me on this forums IRC channel? That would be a great help. |
imagecreatetruecolor has a larger palette of colors, but doesn't support GIFs. Wow, does really this forum have an IRC channel? I think I'll join too (after I get a haircut) :-D
PS: what's the address? |
irc.chatwebdev #talkphp
|
| All times are GMT. The time now is 08:15 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0