Re: [PHP] problem with imagecreate on new webserver

2006-12-18 Thread Richard Lynch




On Sat, December 16, 2006 2:53 pm, [EMAIL PROTECTED] wrote:
 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


Take OUT the following line temporarily, and surf directly to the SRC
of the image:
 header(Content-type: image/png);

PHP will probably be spewing out error messages there for you to look at.

 $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);
 ?

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php




-- 
Some people have a gift link here.
Know what I want?
I want you to buy a CD from some starving artist.
http://cdbaby.com/browse/from/lynch
Yeah, I get a buck. So?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] problem with imagecreate on new webserver

2006-12-17 Thread Chris

[EMAIL PROTECTED] wrote:

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.


You need to narrow the problem down a little bit..

Anything show up in the webserver error logs?


Turn up error reporting:

error_reporting(E_ALL);

and display errors:

ini_set('display_errors', true);

Place both of those at the start of the script and tell us what happens 
then.


--
Postgresql  php tutorials
http://www.designmagick.com/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] problem with imagecreate on new webserver

2006-12-16 Thread macha
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);
?

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php