note 116999 added to function.imagettfbbox

From: Date: Tue, 31 Mar 2015 15:36:25 +0000
Subject: note 116999 added to function.imagettfbbox
Groups: php.notes 
Request: Send a blank email to php-notes+get-202104@lists.php.net to get a copy of this message
I found a simple solution that was working for me: <?php if(!isset($_GET['size'])) $_GET['size'] = 44; if(!isset($_GET['text'])) $_GET['text'] = "Hello, world!"; $size = imagettfbbox($_GET['size'], 0, "ARIAL", $_GET['text']); $xsize = abs($size[0]) + abs($size[2]); $ysize = abs($size[5]) + abs($size[1]); $image = imagecreate($xsize, $ysize); $blue = imagecolorallocate($image, 0, 0, 255); $white = ImageColorAllocate($image, 255,255,255); imagettftext($image, $_GET['size'], 0, abs($size[0]), abs($size[5]), $white, "ARIAL", $_GET['text']); header("content-type: image/png"); imagepng($image); imagedestroy($image); ?> Here is the link with a examples: http://www.tuxradar.com/practicalphp/11/2/6#null ---- Server IP: 80.64.47.13 Probable Submitter: 92.201.127.166 ---- Manual Page -- http://php.net/manual/en/function.imagettfbbox.php Edit -- https://master.php.net/note/edit/116999 Del: integrated -- https://master.php.net/note/delete/116999/integrated Del: useless -- https://master.php.net/note/delete/116999/useless Del: bad code -- https://master.php.net/note/delete/116999/bad+code Del: spam -- https://master.php.net/note/delete/116999/spam Del: non-english -- https://master.php.net/note/delete/116999/non-english Del: in docs -- https://master.php.net/note/delete/116999/in+docs Del: other reasons-- https://master.php.net/note/delete/116999 Reject -- https://master.php.net/note/reject/116999 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#202104) next »