# Deprecating GD functions imagettftext/bbox

- Thread: https://externals.io/message/75880
- Original archive: https://news-web.php.net/php.internals/75880
- Started by Lonny Kapelushnik on 2014-07-22T19:01:49+00:00
- Messages: 6
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #75880 — Lonny Kapelushnik — 2014-07-22T19:01:49+00:00

URL: https://externals.io/message/75880#75880

Morning,

I propose deprecating two GD functions: imagettftext and imagettfbbox.

The reasons I would like to deprecate them are:
1. Their functionality is a subset of imagefttext and imageftbbox
2. The imagettf* functions have the same requirements as the imageft* functions
3. The imagettf* functions parameters are compatible with the imageft* functions parameters

As far as I can tell the original reason for having both functions was because PHP LIBGD is a custom implementation of LIBGD that had additional functionality from the actual LIBGD. While this is still the case it seems that now the required functions (gdImageStringFT and gdImageStringFTEx) exist in both libraries.

The only difference between imagettf* and imageft* functions is the imagettf* functions do not provide the optional ‘extrainfo’ parameter

The only step to migrate from the imagettf* functions to imageft* functions is to change the function names from ‘imagettf*’ to ‘imageft*'

I would like to create a timeline to deprecate and remove the imagettf* functions. Providing a timeline will allow for:
1. Clarity for which PHP functions to use going forward
2. Ability to plan a migration to the new PHP functions
3. Clarity for which PHP functions to improve in php-src
4. Ability to clean up some of the GD code in php-src

I will hold off on proposing an actual timeline for now.

I can implement any coding changes needed.

Please let me know the general thoughts to deprecating these functions. If the reception is positive I would like to  create an RFC to discuss this in full and come up with a timeline.

–––
Hakuna Matata!
Lonny Kapelushnik
https://www.lonnylot.com
732.685.9175

---

## #75919 — Kris Craig — 2014-07-23T02:31:49+00:00

URL: https://externals.io/message/75880#75919 · In reply to: #75880

On Tue, Jul 22, 2014 at 12:01 PM, Lonny Kapelushnik <lonny@lonnylot.com>
wrote:

> Morning,
>
> I propose deprecating two GD functions: imagettftext and imagettfbbox.
>
> The reasons I would like to deprecate them are:
> 1. Their functionality is a subset of imagefttext and imageftbbox
> 2. The imagettf* functions have the same requirements as the imageft*
> functions
> 3. The imagettf* functions parameters are compatible with the imageft*
> functions parameters
>
> As far as I can tell the original reason for having both functions was
> because PHP LIBGD is a custom implementation of LIBGD that had additional
> functionality from the actual LIBGD. While this is still the case it seems
> that now the required functions (gdImageStringFT and gdImageStringFTEx)
> exist in both libraries.
>
> The only difference between imagettf* and imageft* functions is the
> imagettf* functions do not provide the optional ‘extrainfo’ parameter
>
> The only step to migrate from the imagettf* functions to imageft*
> functions is to change the function names from ‘imagettf*’ to ‘imageft*'
>
> I would like to create a timeline to deprecate and remove the imagettf*
> functions. Providing a timeline will allow for:
> 1. Clarity for which PHP functions to use going forward
> 2. Ability to plan a migration to the new PHP functions
> 3. Clarity for which PHP functions to improve in php-src
> 4. Ability to clean up some of the GD code in php-src
>
> I will hold off on proposing an actual timeline for now.
>
> I can implement any coding changes needed.
>
> Please let me know the general thoughts to deprecating these functions. If
> the reception is positive I would like to  create an RFC to discuss this in
> full and come up with a timeline.
>
> –––
> Hakuna Matata!
> Lonny Kapelushnik
> https://www.lonnylot.com
> 732.685.9175
>
>
You've clearly given this some thought, so my suggestion would be that you
go ahead and create the RFC now.  Committing yourself to the idea will
probably make people more likely to invest their time in responding to it.

--Kris

---

## #75991 — Tjerk Meesters — 2014-07-24T04:56:25+00:00

URL: https://externals.io/message/75880#75991 · In reply to: #75880

Hi Lonny,


On Wed, Jul 23, 2014 at 3:01 AM, Lonny Kapelushnik <lonny@lonnylot.com>
wrote:

> Morning,
>
> I propose deprecating two GD functions: imagettftext and imagettfbbox.
>
> The reasons I would like to deprecate them are:
> 1. Their functionality is a subset of imagefttext and imageftbbox
> 2. The imagettf* functions have the same requirements as the imageft*
> functions
> 3. The imagettf* functions parameters are compatible with the imageft*
> functions parameters
>
> As far as I can tell the original reason for having both functions was
> because PHP LIBGD is a custom implementation of LIBGD that had additional
> functionality from the actual LIBGD. While this is still the case it seems
> that now the required functions (gdImageStringFT and gdImageStringFTEx)
> exist in both libraries.
>
> The only difference between imagettf* and imageft* functions is the
> imagettf* functions do not provide the optional ‘extrainfo’ parameter
>
> The only step to migrate from the imagettf* functions to imageft*
> functions is to change the function names from ‘imagettf*’ to ‘imageft*'
>

I'm glad to see you've taken the time to write this down after our small
discussion on chat the other day :)

According to the release process, an x+1.0.0 release may break API, so that
would technically mean they can be removed for php.next granted an RFC is
submitted and accepted before then. That said, I didn't see any clear
guidelines as to how deprecation periods should be outlined, so I would
expect some discussions to arise from that ..


> I would like to create a timeline to deprecate and remove the imagettf*
> functions. Providing a timeline will allow for:
> 1. Clarity for which PHP functions to use going forward
> 2. Ability to plan a migration to the new PHP functions
> 3. Clarity for which PHP functions to improve in php-src
> 4. Ability to clean up some of the GD code in php-src
>

From what I could tell, the clean up will be relatively small because both
functions already call the same underlying php_image*_common() function.


> I will hold off on proposing an actual timeline for now.


> I can implement any coding changes needed.
>
> Please let me know the general thoughts to deprecating these functions. If
> the reception is positive I would like to  create an RFC to discuss this in
> full and come up with a timeline.
>

Personally I think, although the current functions are used a lot more
often (~ 3x based on Google results), the simple fix makes it relatively
easy to port existing code.

From what I could tell you don't have a Wiki account yet, so that would be
the first step :)


>
> –––
> Hakuna Matata!
> Lonny Kapelushnik
> https://www.lonnylot.com
> 732.685.9175
>
>


-- 
--
Tjerk

---

## #75992 — Pierre Joye — 2014-07-24T07:13:29+00:00

URL: https://externals.io/message/75880#75992 · In reply to: #75880

hi,


> Morning,
>
> I propose deprecating two GD functions: imagettftext and imagettfbbox.
>
> The reasons I would like to deprecate them are:
> 1. Their functionality is a subset of imagefttext and imageftbbox
> 2. The imagettf* functions have the same requirements as the imageft*
> functions
> 3. The imagettf* functions parameters are compatible with the imageft*
> functions parameters
>
> As far as I can tell the original reason for having both functions was
> because PHP LIBGD is a custom implementation of LIBGD that had additional
> functionality from the actual LIBGD. While this is still the case it seems
> that now the required functions (gdImageStringFT and gdImageStringFTEx)
> exist in both libraries.
>
> The only difference between imagettf* and imageft* functions is the
> imagettf* functions do not provide the optional ‘extrainfo’ parameter
>
> The only step to migrate from the imagettf* functions to imageft* functions
> is to change the function names from ‘imagettf*’ to ‘imageft*'
>
> I would like to create a timeline to deprecate and remove the imagettf*
> functions. Providing a timeline will allow for:
> 1. Clarity for which PHP functions to use going forward
> 2. Ability to plan a migration to the new PHP functions
> 3. Clarity for which PHP functions to improve in php-src
> 4. Ability to clean up some of the GD code in php-src
>
> I will hold off on proposing an actual timeline for now.
>
> I can implement any coding changes needed.
>
> Please let me know the general thoughts to deprecating these functions. If
> the reception is positive I would like to  create an RFC to discuss this in
> full and come up with a timeline.

It is on my list to mark them as deprecated in the documentation. Also
I am not sure it is worth the disagreement for the users to add
notices or even to remove them as they both use the same underlying
code. Basically there is no gain for us to actually remove them but
yet another notice for the users.

Cheers,
-- 
Pierre

@pierrejoye | http://www.libgd.org

---

## #76002 — Florian Anderiasch — 2014-07-24T10:20:22+00:00

URL: https://externals.io/message/75880#76002 · In reply to: #75992

> hi,
> 
> 
> > […]

As I said on IRC, I think the least invasive action would be to make
them true aliases (so that the ones with less parameters act exactly as
the ones with more) and put that into the docs. This doesn't contradict
future removal.

Greetings,
Florian

---

## #76175 — Lonny Kapelushnik — 2014-07-27T01:36:14+00:00

URL: https://externals.io/message/75880#76175 · In reply to: #75880

Hi all,

I appreciate the immediate feedback in this thread. Given the quick feedback and suggestions I received I wanted to create an RFC to be able to collect everything and move forward. I’ve written it out and properly announced it here.

Lets continue the discussion over there.
