php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20129 ImageTTFText & implode(" ", "$argv")
Submitted: 2002-10-27 20:48 UTC Modified: 2002-10-28 17:23 UTC
From: jbw at justinw dot net Assigned:
Status: Not a bug Package: GD related
PHP Version: 4.2.3 OS: Linux 2.x
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: jbw at justinw dot net
New email:
PHP Version: OS:

 

 [2002-10-27 20:48 UTC] jbw at justinw dot net
I cannot use implode with the ImageTTFText function. 

The following code does not work, it returns a broken image:

<?php
    Header("Content-type: image/png");
    //$string = "Test";
    $string = implode(" ", "$argv");
    $string = urldecode($string);
    $im = imageCreateFromPng("header_img2.png");
    $white = ImageColorAllocate($im, 167, 194, 206);
    $px = (imagesx($im)-7.5*strlen($string))/2;
    ImageTTFText($im, 30, 0, $px, 42, $white, "/usr/local/apache/htdocs/ttf/ARTBRUSH.TTF", "$string");
    ImagePng($im);
    ImageDestroy($im);
?>

If I comment out the implode line and set $string then it works great. I use implode with other code for creating other images but not with ImageTTFText.

Thanks!

- Justin

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-27 22:07 UTC] sterling@php.net
ohhh, god...
 [2002-10-28 16:35 UTC] jbw at justinw dot net
Ok, the status is changed to Bogus. Is this working as designed and not a problem/bug? Thanks,

- Justin
 [2002-10-28 16:46 UTC] rasmus@php.net
$argv is an array, and implode() takes an array.  Sterling is wondering to the powers that be why in God's name you passed $argv in quotes (thereby making it a string) to the implode function.
 [2002-10-28 17:21 UTC] jbw at justinw dot net
Oh, I don't know why I did that.... I took the "" off and it is still not working... errrr... Any ideas? Sorry to take up your guys time on this...

- Justin
 [2002-10-28 17:23 UTC] rasmus@php.net
So stop and debug it without the image-related stuff in there.
 [2002-10-28 18:41 UTC] jbw at justinw dot net
OK, I am an idot...

Setting register_globals to on fixed my problem. When it is set to off I get "Bad arguments to implode()" I am not sure why some of my scripts still work and others don't... 

Sorry to have logged this bug, of couse it is not a bug... errr

Thanks!!

- Justin
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 19 10:01:32 2024 UTC