problem with imagecreate on new webserver
| From: | macha at kingdomsend dot com | Date: | Sat, 16 Dec 2006 20:53:51 +0000 |
| Subject: | problem with imagecreate on new webserver | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-245919@lists.php.net to get a copy of this message | ||
i am moving my webserver from a windows box to a linux box with php ver
5.2.0 and noticed i am having a problem with a php file(code below). i
thought it was a module i was missing but looking at the php config
file all the same modules are loaded. allow_url_fopen is enabled. what
would i be missing in the php install that would make this code not
work correctly from one machine to the other.
when loading on the new box all i get is a image with
'http://localhost/imgfile.php'
<?
session_start();
define( 'SITE' , 'http://localhost' );
//define 7char code
$md5 = md5(microtime() * mktime());
$string = substr($md5,0,7);
//create image
header("Content-type: image/png");
$img= imagecreatefrompng(SITE. '/images/img.png');
$white = imagecolorallocate($img, 233, 239, 239);
$line = imagecolorallocate($img,233,239,239);
for ($i = 1; $i <= 5; $i++) {
$x1 = rand(1,149);
$x2 = rand(1,149);
$y1 = rand(1,49);
$y2 = rand(1,49);
imageline($img, $x1, $y1, $x2, $y2, $line);
}
//put code in image
imagestring($img, 5, 35, 25, $string, $white);
//save key to session
$_SESSION['key'] = md5($string);
imagepng($img);
?>