Raised This Month: $ Target: $400
 0% 

Whats wrong with this php script??


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Extremeone
Senior Member
Join Date: Jan 2005
Old 09-26-2005 , 16:17   Whats wrong with this php script??
Reply With Quote #1

all im gettin is a black image 400x25
Code:
<?php
header("Content-type: image/png");
$number = rand(1,9);
if($number==1)$string2 = "all your base r belong 2 us";
if($number==2)$string2 = "somebody set up us the bomb";
if($number==3)$string2 = "Resistance is futile";
if($number==4)$string2 = "R0D3NTS are cute";
if($number==5)$string2 = "H4X0R in thE yur PC1?!";
if($number==6)$string2 = "Dude w3re's my c4r?";
if($number==7)$string2 = "s0m3on3 st0l3 my mega hurtz!!";
if($number==8)$string2 = "move zig for great justice";
if($number==9)$string2 = "Rodents make the world cool";
$im = imagecreatetruecolor(400, 25);
$bg = imagecolorallocatealpha($im, 0, 0, 9, 127);
imagestring($im, 5, 0, 0, $string2, $text_color);
$text_color = imagecolorallocate($im, 255, 0, 0);
imagepng($im);
imagedestroy($im);
?>
i cant get this stupid thing to work for the life of me
Extremeone is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 09-26-2005 , 17:03  
Reply With Quote #2

Quote:
Code:
imagestring($im, 5, 0, 0, $string2, $text_color);
$text_color = imagecolorallocate($im, 255, 0, 0);
Move $text_color = .... above imagestring.
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Extremeone
Senior Member
Join Date: Jan 2005
Old 09-26-2005 , 17:42  
Reply With Quote #3

wow.........
thanks.....
i wouldnt have thought of that in a million years........



do you know why the transparency of the background isnt working?
i have it like this now
Code:
$bg = imagecolorallocatealpha($im, 0, 0, 9, 0);
$im = imagecreatetruecolor(400, 25);
and it says it cant be displayed cause it contains errors
Extremeone is offline
XxAvalanchexX
Veteran Member
Join Date: Oct 2004
Location: abort73.com
Old 09-26-2005 , 18:04  
Reply With Quote #4

You create a color for $im before you create $im? I don't think you really know PHP but instead copied some script and are trying to fumble around with it.

If it says the image cannot be displayed because it contains errors, then remove the header type so you can see the PHP output plainly.
__________________
No longer around. Thanks your support, everyone! As always:
THIS ONES FOR YOU
3000 PTS
XxAvalanchexX is offline
Extremeone
Senior Member
Join Date: Jan 2005
Old 09-26-2005 , 18:19  
Reply With Quote #5

Quote:
Originally Posted by XxAvalanchexX
You create a color for $im before you create $im? I don't think you really know PHP but instead copied some script and are trying to fumble around with it.

If it says the image cannot be displayed because it contains errors, then remove the header type so you can see the PHP output plainly.
bleh.............of course i dont know PHP.....i just dabble

actually though.....very little of this code is stolen......
mostly just the thing with $number
i used http://us3.php.net/quickref.php for the majority of it

btw i AM gonna change those stupid sayings as soon as i get this thing working


when i remove the header all it says is this
Code:
‰PNG
Extremeone is offline
Extremeone
Senior Member
Join Date: Jan 2005
Old 09-26-2005 , 18:40  
Reply With Quote #6

ok well i did some more reasearch and i edited the code to make it like this

Code:
<?php
header("Content-type: image/png");
$number = rand(1,9);
if($number==1)$string2 = "all your base r belong 2 us";
if($number==2)$string2 = "somebody set up us the bomb";
if($number==3)$string2 = "Resistance is futile";
if($number==4)$string2 = "R0D3NTS are cute";
if($number==5)$string2 = "H4X0R in thE yur PC1?!";
if($number==6)$string2 = "Dude w3re's my c4r?";
if($number==7)$string2 = "s0m3on3 st0l3 my mega hurtz!!";
if($number==8)$string2 = "move zig for great justice";
if($number==9)$string2 = "Rodents make the world cool";
$im = imagecreatetruecolor(400, 25);
$bg = imagecolorallocatealpha($im, 200, 200, 200, 127);
imagefill($im, 0, 0, $bg);
$text_color = imagecolorallocate($im, 255, 0, 0);
imagestring($im, 5, 6, 5, $string2, $text_color);
imagepng($im);
imagedestroy($im);
?>
now this is supposed to work but i get this:
Code:
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.
anyone?
Extremeone is offline
Energie
BANNED
Join Date: Jul 2005
Old 09-26-2005 , 21:55  
Reply With Quote #7

on which line did the error Occur ? ( look it up in the log file )
Energie is offline
Extremeone
Senior Member
Join Date: Jan 2005
Old 09-26-2005 , 22:34  
Reply With Quote #8

it didnt........
the server hasnt made any error logs yet
Extremeone is offline
BAILOPAN
Join Date: Jan 2004
Old 09-26-2005 , 23:14  
Reply With Quote #9

Internet Explorer doesn't support transparent/alpha PNGs. Is that what you're trying to do?
__________________
egg
BAILOPAN is offline
Extremeone
Senior Member
Join Date: Jan 2005
Old 09-27-2005 , 08:59  
Reply With Quote #10

yeah....
im using firefox.......
and it just refuses to work.....
i think its a problem with my host though.......
Extremeone is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode