Re: [baltimorephp] Errors using imagecreate

From: Kevin S.
Sent on: Monday, April 23, 2012 7:27 PM
That's actually to be expected.   A blank file isn't a valid png.  Next step is to check your error reporting in the php.ini.  You almost certainly have an error in your script that isn't displaying. 

display_errors = 1 is the easy way, but I'd recommend configuring php error logging if it isn't (and checking the error log if it is).  I think default is to log to the apache error log file, but who knows what your install wants to do.
Kevin


From: Joe Tseng <[address removed]>
To: [address removed]
Sent: Monday, April 23,[masked]:46 PM
Subject: RE: [baltimorephp] Errors using imagecreate

Just to cut down on the clutter, I removed everything from my PHP file and had just the header file:

header("Content-type: image/png");

That was enough to generate that error.



Date: Mon, 23 Apr[masked]:07:58 -0700
From: [address removed]
Subject: Re: [baltimorephp] Errors using imagecreate
To: [address removed]


Comment out the header line and see what is being output.  It should be a bunch of line noise, but that way you can see if any text is being inadvertently being displayed.  A php error/warning/notice is the usual cause of this result.  Knowing the errors will help you troubleshoot.  Also make sure there isn't any whitespace after the ?> tag (or just omit it from the file entirely).
Kevin


From: Joe Tseng <[address removed]>
To: [address removed]
Sent: Monday, April 23,[masked]:52 AM
Subject: [baltimorephp] Errors using imagecreate

I recently migrated some apps to a new Solaris server and I'm getting some errors back with some graphics-related calls.  Just as a test I inserted a small test script:

<?php
    header('Content-type: image/png');
    $myImage = imagecreate(200, 100);
    $myGray = imagecolorallocate($myImage, 204, 204, 204);
    $myBlack = imagecolorallocate($myImage, 0, 0, 0);
    imageline($myImage, 15, 35, 120, 60, $myBlack);

    imagepng($myImage);
    imagedestroy($myImage);
?>

And I got the following message:

The image "..." cannot be displayed because it contains errors.

My PHP instance was compiled from source per a request from our server group.  My makefile was created using the following flags:

'./configure' '--prefix=/export/appl/pkgs/php/v5.3.9' '--with-apxs2=/export/appl/pkgs/httpd/latest/bin/apxs' '--with-mysql=/export/appl/pkgs/mysql/latest' '--with-mysqli=/export/appl/pkgs/mysql/latest/bin/mysql_config' '--with-gd=/export/appl/pkgs/libgd/latest' '--with-pear' '--with-png-dir=/export/appl/pkgs/libpng/latest' '--with-jpeg-dir=/export/appl/pkgs/jpeg/latest' '--with-curl=/export/appl/pkgs/curl/latest' '--with-freetype-dir=/export/appl/pkgs/freetype/latest' '--with-mhash=/export/appl/pkgs/mhash/latest' '--with-mcrypt=/export/appl/pkgs/libmcrypt/latest' '--enable-pcntl' '--enable-soap' '--enable-mbstring' '--with-zlib-dir=/export/appl/zlib/v1.2.5' '--with-ldap'

I don't think any sort of error msg would be visible in the Apache error or access log.  Am I missing anything in my script or my compile command?

thx,

 - Joe


If you type "Google" into Google, you can break the Internet.  -- Jen Barber




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Joe Tseng ([address removed]) from Baltimore PHP.
To learn more about Joe Tseng, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]






--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Joe Tseng ([address removed]) from Baltimore PHP.
To learn more about Joe Tseng, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]


Our Sponsors

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy