php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45063 Image functions doesn'twork
Submitted: 2008-05-22 01:24 UTC Modified: 2008-05-25 02:20 UTC
From: ahmedt at student dot cbhs dot school dot nz Assigned: pajoye (profile)
Status: Closed Package: GD related
PHP Version: 5.2.5 OS: Windows XP Home
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ahmedt at student dot cbhs dot school dot nz
New email:
PHP Version: OS:

 

 [2008-05-22 01:24 UTC] ahmedt at student dot cbhs dot school dot nz
Description:
------------
I can't create images width images functions. Even the pp documentation examples for png image returns something like "The [URL] contains error, image can't be displayed". If yiu take off the 'header()' call. It returns some squares, un-readable by human characters. I am using GD 2.0.34.(php 5.2.5) phpinfo() says GD is enabled and able to make png, jpeg, gif images. GD version is the version that comes with PHP 5.2.5

Reproduce code:
---------------
something like "The url http://127.0.p0./image.php contains error, image can't be displayed". 

Actual result:
--------------
To output images png,jpeg ect.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-05-22 08:19 UTC] pajoye@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2008-05-22 23:31 UTC] ahmedt at student dot cbhs dot school dot nz
Sample Code: taken out pf PHP Doumentation. It's an example by php documentation to illustrate the use of imagecreate().

<?php
header("Content-type: image/png");
$im = @imagecreate(110, 20)
    or die("Cannot Initialize new GD image stream");
$background_color = imagecolorallocate($im, 0, 0, 0);
$text_color = imagecolorallocate($im, 233, 14, 91);
imagestring($im, 1, 5, 5,  "A Simple Text String", $text_color);
imagepng($im);
imagedestroy($im);
?>
 [2008-05-23 00:47 UTC] pajoye@php.net
remove the "?>" and everything will run fine.

You are sending chars (like new lines and white spaces).
 [2008-05-25 02:20 UTC] ahmedt at student dot cbhs dot school dot nz
It didn't work by removing the end "?>". 

Problem was due to script encoding. I was using 'Notepad++' which has been set 'utf-8'. When I changed the encoding to 'ANSI' everything worked EVEN with the end "?>"
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 21:01:28 2024 UTC