Re: problem with imagecreate on new webserver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 






On Sat, December 16, 2006 2:53 pm, macha@xxxxxxxxxxxxxxx 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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux