开发者

PHP Image Generation With Super / Sub Scripts

开发者 https://www.devze.com 2023-03-24 10:50 出处:网络
I\'m looking to generate PHP images on the fly. So far I\'m using this script and its doing well: <?php

I'm looking to generate PHP images on the fly. So far I'm using this script and its doing well:

<?php

header("Content-type: image/png");
$strin开发者_StackOverflowg = $_GET['text'];
$im     = imagecreatefrompng("images/button1.png");
$orange = imagecolorallocate($im, 220, 210, 60);
$px     = (imagesx($im) - 7.5 * strlen($string)) / 2;
imagestring($im, 3, $px, 9, $string, $orange);
imagepng($im);
imagedestroy($im);

?>

However I want to use super/subscripts in the string input. I've tried using the HTML equivilent of and but to no avail.

Any pointers?


Write in a smaller font size and a higher/lower vertical position relative to the other text. That's all super/sub scripts are... different parameters for imagestring. There's no need for there to be a separate way to write that text from other text in a 2D drawing lib.

0

精彩评论

暂无评论...
验证码 换一张
取 消