graphics problem



i prototype on my windows pc. i'm trying to rollout a demo version on a rh
linux box. both use apache and php 5. i'm having problems with generating
graphics on the linux side. in particular, the login page creates a graphic
that has a security code that the user types in and submits with their
un/passwd. on the linux box, eventually the image request just times out in
the browser leaving the familiar X-in-a-square-where-an-image-should-be. i'm
pulling the gd2 dll into php cgi on windows and linux appears to have it
configured in as well. both show the following in phpinfo(). any light
someone could shed on this would be a tremendous help...tia!

php info for gd (same for windows and linux):

GD Support => enabled
GD Version => bundled (2.0.28 compatible)
FreeType Support => enabled
FreeType Linkage => with freetype
FreeType Version => 2.1.9
GIF Read Support => enabled
GIF Create Support => enabled
JPG Support => enabled
PNG Support => enabled
WBMP Support => enabled
XBM Support => enabled


here's the pertinent login html:

<img src="http://dev.example.com/get.security.image.php";>

and here's the intermediate php script (get.security.image.php):

<?
require_once 'relative.path.php';
require_once $relativePath . 'site.cfg.php';
require_once $site->classDirectory . 'security.image.class.php';
$image = new securityImage($site->securityCode, $site->imagesDirectory .
'security.image.jpg');
$image->create(securityImageConstants::PNG);
?>

here's the security.image.class.php:

<?
class securityImageConstants
{
const GD = 0;
const GIF = 1;
const JPG = 2;
const PNG = 3;
}

class securityImage
{
public $codeLength = 6;
public $accentColor = '990000';
public $fontColor = '990000';
public $fontSize = 48;
public $image = null;
public $securityCode = '';
public $securityImage = '';

private function __clone(){}

public function __construct($securityCode, $securityImage)
{
$this->securityCode = $securityCode;
$this->securityImage = $securityImage;
}

private function __copy(){}

public function create($type = securityImageConstants::PNG)
{
$imageSize = getimagesize($this->securityImage);
$this->image = imagecreatefromjpeg($this->securityImage);
$imageWidth = $imageSize[0];
$imageHeight = $imageSize[1];
$accentColor = imagecolorallocate(
$this->image
,
hexdec(substr($this->accentColor,
0, 2)) ,
hexdec(substr($this->accentColor,
2, 2)) ,
hexdec(substr($this->accentColor,
4, 2))
);
$fontColor = imagecolorallocate(
$this->image
,
hexdec(substr($this->fontColor,
0, 2)) ,
hexdec(substr($this->fontColor,
2, 2)) ,
hexdec(substr($this->fontColor,
4, 2))
);
$fontHeight = imagefontheight($this->fontSize);
$fontWidth = imagefontwidth($this->fontSize);
$text = substr(preg_replace('//', '$1 ',
$this->securityCode), 0, - 1);
$x = ($imageWidth - strlen($text) * $fontWidth) / 2;
$y = ($imageHeight - $fontHeight) / 2;
for ($i = 0; $i < strlen($text); $i++)
{
imagechar(
$this->image ,
$fontHeight ,
$x + ($fontWidth * $i) - 1 ,
$y ,
$text[$i] ,
$accentColor
);
imagechar(
$this->image ,
$fontHeight ,
$x + ($fontWidth * $i) ,
$y - 1 ,
$text[$i] ,
$fontColor
);
}
switch ($type)
{
case securityImageConstants::GD : imagegd($this->image) ; break;
case securityImageConstants::GIF : imagegif($this->image) ; break;
case securityImageConstants::JPG : imagejpeg($this->image) ; break;
default : imagepng($this->image) ; break;
}
imagedestroy($this->image);
}
}
?>


.



Relevant Pages

  • RE: [PHP] two small issues with php mail
    ... This comment is extracted directly from PHPMailer source (before the ... so I wouldn't expect the mail function on Windows to work ... Other options include testing it on a linux box (if you have one, ... That said, don't blame PHP, don't blame us, and don't even blame your code, ...
    (php.general)
  • Re: graphics problem
    ... both use apache and php 5. ... graphics on the linux side. ... class securityImage ... private function __clone ...
    (alt.php)
  • Re: Ubuntu + PHP-Entwicklung
    ... programmiere auch PHP unter Linux und benutze vim mit einigen Macros, ... Eclipse wollte ich auch unter Windows schon ausprobieren, ...
    (de.comp.os.unix.linux.misc)
  • Re: 500 Internal Server Error w/ PHP 5 and Vista
    ... about getting the page up and working in Vista. ... I've set up PHP as a handler in IIS. ... transferring between Linux and Windows, the error was caused by a messed ...
    (comp.lang.php)
  • Re: help!!!!!!!! MySQL, PHP, and Apache configuration.
    ... Use/Learn PHP. ... If you are to afraid to break away from Windows, ... and I have used Linux (I also ... Jeffrey D. Silverman | jeffrey AT jhu DOT edu ...
    (comp.lang.php)

Loading