View Full Version : PHP - GD Failure.
lolwut
28-09-2007, 09:11 PM
Well, I made a script that takes abunch of variables and turns them into an image, basically. The result should be like "#their_name# is #system_chosen_var# in their free time."
But it says "cannot be displayed due to errors".
Here's the page source.
http://habaround.co.uk/index_source
Page.
http://habaround.co.uk/index.php
Help please?
Dentafrice,
28-09-2007, 09:16 PM
remove:
echo $im;
move:
header("Content-type: image/png");
right above imagepng
then tell me the error
lolwut
29-09-2007, 06:42 AM
Erm.
Didn't exacly get that.
But I removed the echo line and the header(""); got removed too.
New source: http://habaround.co.uk/index_source
Link: http://habaround.co.uk/?name=Anything
ScottDiamond.
29-09-2007, 09:24 AM
<?php
$name = $_GET['name'];
$p1 = "Abraham Lincoln";
$p2 = "Martin Luther King";
$p3 = "Clark Kent";
$p4 = "Spider Pig";
$p5 = "Eddie Murphy";
$p6 = "Avril Lagvine";
$p7 = "Steven Gerrard";
$p8 = "Jamie T";
$p9 = "Dave Grohl";
$p10 = "Davina McCall";
$rand = rand(1,10);
if($rand == "1"){
$output = $p1;
}
if($rand == "2"){
$output = $p2;
}
if($rand == "3"){
$output = $p3;
}
if($rand == "4"){
$output = $p4;
}
if($rand == "5"){
$output = $p5;
}
if($rand == "6"){
$output = $p6;
}
if($rand == "7"){
$output = $p7;
}
if($rand == "8"){
$output = $p8;
}
if($rand == "9"){
$output = $p9;
}
if($rand == "10"){
$output = $p10;
}
$op = $name . " is " . $output . " in their free time.";
$string = $op;
header("Content-type: image/png");
$im = imagecreatefrompng("bg.png");
$orange = imagecolorallocate($im, 220, 210, 60);
$px = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
imagepng($im);
imagedestroy($im);
?>
lolwut
29-09-2007, 10:00 AM
Changed source to ScottDiamond.'s one.
Says "The image “http://habaround.co.uk/?name=Hello” (http://habaround.co.uk/?name=Hello%E2%80%9D) cannot be displayed, because it contains errors."
And in my error_log it says "[29-Sep-2007 05:00:22] PHP Fatal error: Call to undefined function: imagecreatefrompng() in /home/habaroun/public_html/index.php on line 51".
ScottDiamond.
29-09-2007, 10:26 AM
Does bg.png exsist?
You have not got GD installed, its outdated or its not working properly. Give us a link to a phpinfo page.
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2025 vBulletin Solutions Inc. All rights reserved.