Jump to content

GD problem with PHP 5.2.8 on Apache 2.2.11


Recommended Posts

I'm somewhat perplexed, i've two generic-ish scripts that are on my local server and my web server, they work perfectly fine on my web server but my local server only the first script actually works.

 

The local server is running Windows 2003 Enterprise, with Apache 2.2.11 running, along side PHP 5.2.8, both freshly installed, with the GD extension installed on PHP via it's installer menus, i've gone in there and checked the php_gd2.dll line manually and it's fine, i've made sure temp directories are writable and that the mime types are all set up, the first script works, and tests such as gd_info come back positive,

First script is as follows :

 

<?php

header("Content-type: image/png");
$string = $_GET['text'];
$im     = imagecreatefrompng("button1.png");
$orange = imagecolorallocate($im, 220, 210, 60);
$px     = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
imagepng($im);
imagedestroy($im);

?>

 

This works fine on both the web server and local server.

However this second script :

 

<?php
header ("Content-type: image/png");
$src = array ('base.jpg', $_GET['x'], $_GET['y']);   
$imgBuf = array ();
foreach ($src as $link)
{
   switch(substr ($link,strrpos ($link,".")+1))
   {
       case 'png':
           $iTmp = imagecreatefrompng($link);
           break;
       case 'gif':
           $iTmp = imagecreatefromgif($link);
           break;               
       case 'jpeg':           
       case 'jpg':
           $iTmp = imagecreatefromjpeg($link);
           break;               
   }
   array_push ($imgBuf,$iTmp);
}
$iOut = imagecreatetruecolor ("200","200") ;
foreach ($imgBuf as $image) 
{
    imagecopy($iOut,$image,0,0,0,0,imagesx($image),imagesy($image));
}
imagepng($iOut);
?> 

Only works on my web server, not my local server, even though the files are the same and (to my knowledge), the functionality of the gd versions is too.

 

Is there anything i could be overlooking here?

 

Thanks in advance.

Link to comment
Share on other sites

It would be real nice it you told us what it was doing, rather than  just that it does not work. What do you see in front of you?

 

Edit: my edit to match information you changed in the post. You need to post your actual code in your file. Your first posted code, before you edited the post, contained a short open tag <? that if actually present would explain why the code is not working.

Link to comment
Share on other sites

It would be real nice it you told us what it was doing, rather than  just that it does not work. What do you see in front of you?

 

Edit: my edit to match information you changed in the post.

Displaying a blank page when loading, also about the <?php instead of <? was just a cut+paste error when making the post, rectified it a moment ago.

i *THINK* i've figured it out, which made the few minutes writing this post up kind of worthless now, the secondary scsi drive is failing integrity checks, and the second drive is where i have my temp folders setup, as well as where php is installed, going to reinstall php to another drive and see if it solves the problem

Link to comment
Share on other sites

Ah all sorted, while the php install was still good, the web server files (while good in part), were corrupting, so when i moved the files via ftp from my laptop to the local server, even though they were showing up they were 0 bytes, ack!, feel rather stupid now.

 

Thanks anyway for the help, off to find a new drive now  :-\

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.