Req #81334 [Com]: Rename imagettfbbox/text string/text parameter

From: Date: Mon, 09 Aug 2021 09:02:55 +0000
Subject: Req #81334 [Com]: Rename imagettfbbox/text string/text parameter
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235694@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81334&edit=1 ID: 81334 Comment by: royalindie dot com at gmail dot com Reported by: admin at kapsonfire dot de Summary: Rename imagettfbbox/text string/text parameter Status: Open Type: Feature/Change Request Package: GD related Operating System: - PHP Version: 8.0.9 Block user comment: N Private report: N New Comment: A decent logo design can help you make that all-important first impression on a client. Your corporation's beliefs are communicated through logos, which can tell a story and assist consumers in trusting your brand. Your company will be at a loss right away if your logo does not send the correct information to a potential client. It might make the distinction between the competitors and you being chosen. We enlisted the aid of some of our most talented designers to produce guidelines to assist businesses in creating the ideal logo for their business. https://www.prolancerr.com/categories/graphics-amp-design/logo-design Previous Comments: ------------------------------------------------------------------------ [2021-08-06 08:55:55] cmb@php.net Oh, that's indeed unfortunate. I'm not sure whether we still can change that in a minor version for BC reasons. ------------------------------------------------------------------------ [2021-08-06 08:47:08] admin at kapsonfire dot de sorry, misswrote imagettfbbox uses $string for the text imagettftext uses $text for the text ------------------------------------------------------------------------ [2021-08-06 08:46:12] admin at kapsonfire dot de Description: ------------ Since PHP supports spreading named parameters, i'd like to see imagettfbbox and imagettftext using the same paramater names. imagettfbbox uses $string for the text imagettfbbox uses $text for the text Test script: --------------- <?php //header("Content-Type: image/png"); $im = @imagecreate(200, 200) or die("Cannot Initialize new GD image stream"); $background_color = imagecolorallocate($im, 50, 50, 200); $text_color = imagecolorallocate($im, 255,255,255); $fontConfig = [ 'size' => 75, 'angle' => 0, 'font_filename' => "Roboto-Regular.ttf", 'string' => 'PA', ]; $bb = imagettfbbox(...$fontConfig); $w = $bb[2] - $bb[0]; $h = $bb[3] - $bb[1]; imagettftext(...([ 'image' => $im, 'color' => $text_color, 'x' => (100-$w/2), 'y' => (100-$h/2), ]+$fontConfig)); imagepng($im); imagedestroy($im); Expected result: ---------------- No Error Actual result: -------------- Fatal error: Uncaught Error: Unknown named parameter $string in image.php:24 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=81334&edit=1

« previous php.bugs (#235694) next »