Painting a half circle

i would like to paint a text into a colored rectangle which have on the side a half filled circle.

****************
******TEXT********
******TEXT**********
******TEXT**********
******************
****************

Did you know what i mean ?
The rectangle can i make with a Table, but how the circle ? have i to use a image ? What is about the color ?
Should work under IE5.0
Andi4553Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
GibbleConnect With a Mentor Commented:
You will place this in your page
<IMG SRC="image.php?label=Button1"><br>
<IMG SRC="image.php?label=Button2"><br>
<IMG SRC="image.php?label=Button3"><br>

image.php will look like this:
<?
  //Tell the browser its a gif
  Header( "Content-type: image/gif");

  //Create the image 200x200 pixels
  $image = imagecreate(400,200);

  //Lets setup the colors to use
  $maroon = ImageColorAllocate($image,100,0,0);
  $white = ImageColorAllocate($image,255,255,255);

  //Lets draw our image
  ImageFilledRectangle($image, 0, 0, 350, 200, $maroon);
  ImageArc($image, 350, 100, 50, 50, 0, 360, $maroon);
  ImageFillToBorder($image, 351, 100, $maroon, $maroon);
  ImageString($image, 5, 100, 10, $label, $white);

  //Lets place it on the screen
  ImageGIF($image);

  //And then destroy the image that we are storing in memory:
  ImageDestroy($image);
?>

This should work, But since I don't have a PHP machine near me, I can't test it :P

Try it and lets see what happens!
0
 
GibbleCommented:
An image is the best approach.  But you can also do that with PHP.

--With an image
<table>
<tr>
<td style="background:red;">Some Text</td>
<td><img src="redhalfcircle.gif"/></td>
</tr>
</table>

0
 
cheekycjCommented:
To have the most consistant look and feel.. using an image would be the best approach.

CJ
0
Get 10% Off Your First Squarespace Website

Ready to showcase your work, publish content or promote your business online? With Squarespace’s award-winning templates and 24/7 customer service, getting started is simple. Head to Squarespace.com and use offer code ‘EXPERTS’ to get 10% off your first purchase.

 
cheekycjCommented:
Posted at the SAME time! LOL
0
 
GibbleCommented:
I beat you :P
hehe thats pretty good, we need to get seconds in there!
0
 
COBOLdinosaurCommented:
You will need to create the half circle as an image.

Then put it in a layer and put the text in another layer
on top of the image like this:

<div style="position:absolute;top:???;left:???;z-index:1;width:???;height:???">
   <img border="0" src="halfcircle.gif" width="???" height="???">
</div>

<div style="position:absolute;top:???;left:???;z-index:10;width:???;height:???">
   text<br>
   text<br>
   text<br>
</div>

You will need to determine the values for top, left, width, and height
to get the alighnment you want.  The div with the text could also be
further styled to control its background color and text color.

Cd&
0
 
GibbleCommented:
Way to make it complicated CD& :P
0
 
webwomanCommented:
I'd do the whole thing as an image... any decent drawing program allows you to wrap/align text, and you'd have total control over how it looked.

Doing it with scripting of some kind should work -- but you won't have the same control over how things wrap or what font is used as you would with a graphic.

So it pretty much hinges on how crucial the look is and what tools you have available.
0
 
webwomanCommented:
Unless, of course, we're reading this completely wrong.

What side would the text be next too? If the text is next to the flat side of the half-circle, you could use a table, put the graphic in one cell and the text in the other, and align the text so it sat against the flat of the semi-circle. You'd still run into a text size concern, but that could be pretty well controlled with CSS.

If, however, you want the text to wrap the CIRCULAR side, that's different. Then you would be better off using a drawing program and making one graphic with the circle and the text.
0
 
Andi4553Author Commented:
The text should be assigned to the flat side.
i also want to change the color of the background (if using a table of the Cell Background) and change the image, for the circle (making for every color an image)
Is there a better way ?
0
 
GibbleCommented:
PHP if you have it would probably be easiest then...it can create images on the fly.

This of course is assuming you have access to put PHP on the server.
0
 
Andi4553Author Commented:
Yes i have PHP Support but i am not able to programm it.
If you can help me, it would be great !
0
 
GibbleCommented:
Ok you will also need to see if the graphics modules for PHP are installed, I will get back to you with a test you can run hopefully within the hour, I am quite busy here so you will have to be patient, sry.
0
 
iamkalyangCommented:
if the half circle needs to be dynamically generated, ther is a approach, but it does not produce the accurate one..

what can be done is

split the area into a tiny cells using tables which contain may small columns.. hence dynamically as per ur wish u can paint them..

it works fine, ifused with rect and sq.. we used it for generating poll results..

try it out..

all the best
0
 
GibbleCommented:
iamkalyang,
Be careful doing this with NS as it has trouble with tables, too many columns and rows and it slows down considerably.
0
 
COBOLdinosaurCommented:
This question has been abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.

Cd&
0
 
COBOLdinosaurCommented:
It is time to clean this abandoned question up.  

I am putting it on a clean up list for CS.

<recommendation>
points to Gibble

</recommendation>

If anyone participating in the Q disagrees with the recommendation,
please leave a comment for the mods.

Cd&
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.