|
Posted by Steve on 10/06/06 13:54
thanks erwin. i actually do go that route before reading your post...and it
helped. i have an application class that holds path information...the path
to the security image was wrong. it's all good now.
thanks again,
me
"Erwin Moller"
<since_humans_read_this_I_am_spammed_too_much@spamyourself.com> wrote in
message news:45262746$0$4518$e4fe514c@news.xs4all.nl...
| Steve wrote:
|
| > 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);
| > }
| > }
| > ?>
|
| Hi,
|
| I am too lazy to check your whole script, but you should try to get the
| error.
| This can be done in several ways:
|
| 1) Look in your errorlog
| 2) Call get.security.image.php directly, but change the content-type to
| "text/html".
| Of course this will return a load of crap on succes, because the imagefile
| is not ment to be displayed as text, but you also see the errors.
|
| Good luck,
|
| Regards,
| Erwin Moller
Navigation:
[Reply to this message]
|