Jump to content

kamdeng

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

kamdeng's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ok so I've gotten this far.... well actually I found this code somewhere. [url=http://chunkymoon.com/test.php?text=this%20is%20curved%20text%20]http://chunkymoon.com/test.php?text=this%20is%20curved%20text%20[/url] [code]<?php header("Content-type: image/png"); $im = imagecreate(400,200); $white = imagecolorallocate($im, 255,255,255); $black = imagecolorallocate($im, 0,0,0); $cx = 200; $cy = 100; $cr = 80; if (isset($_REQUEST["text"])) {     $text = $_REQUEST["text"]; } else {     $text = 'hello there'; } $length = strlen($text); $degDelta = 360 / $length; if ($length > 0) {     $color = $black;     for ($x = 0; $x < $length; $x++) {         // Circular Text         $AX = $cx - cos(deg2rad($degDelta * $x)) * $cr;         $AY = $cy - sin(deg2rad($degDelta * $x)) * $cr;         imagettftext($im, 20, -($degDelta * $x + $degDelta / 2)+90 , $AX, $AY, $color, 'arial.ttf', $text[$x]);     } } imagepng($im); imagedestroy($im); ?> [/code] Almost there... Here is what I need to fix.  I don't want the text to be spread out all the way to make a circle.  So I want each character next to each other on the circular path.  If the string length is long enough so that it goes all the way around the circle that is okay.  But I don't want a 5 letter word spread out all around the circle.  I'm pretty sure this is possible.  I took a stab at it, but completely ruined things.  Anyone good at trigonometry?
  2. Wow, that's pretty good!  Nice work with ImageMagick.  I've posted on ImageMagick forums before and they said that curved text on a path was not currently possible.  But I guess they were wrong.  One complaint about this is that it somewhat skews the text towards the sides of the curve as opposed to simply rotating the character it seems to squish it.  I wanted it to look more like my samples images which have the bottom of the character on the path of the curve.  I know, I'm being pretty picky. And also... like you mentioned I would need to somehow adjust the command based on text length.  Don't know how I would calculate the different parameters.  Because the font, size, and string length are all dynamic and the curved text needs to be generated on the fly. Thanks for the effort SA.  This is very close!
  3. Hello, I am a first time poster on these forums.  Hopefully someone can help me and hopefully I can help others in the future. I am writing a pretty complicated application using PHP & GD to generate images with text.  I need to generate text on a curved path on the fly, something like this: Curved Up [img]http://chunkymoon.com/steven/curveup.gif[/img] & Curved Down [img]http://chunkymoon.com/steven/curvedown.gif[/img] I know that you can create the text at an angle using the function imagettftext, as it is one of the parameters.  If you break a string down to its individual characters then adjust the angle and x and y, I'm sure this is possible.  I just have no clue how to script it. Any ideas would be much appreciated.  Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.