PHP Classes

Decimal Point

Recommend this page to a friend!

      Image Font  >  All threads  >  Decimal Point  >  (Un) Subscribe thread alerts  
Subject:Decimal Point
Summary:How to Show
Messages:2
Author:Michael Turnbull
Date:2012-02-20 22:37:16
Update:2012-02-21 08:21:55
 

  1. Decimal Point   Reply   Report abuse  
Picture of Michael Turnbull Michael Turnbull - 2012-02-20 22:37:16
How would I show a decimal point if I wish to use Image Font for Currency?
Great script for reading a database value (Price) but presenting it on screen in a coll/marketing format.

Many Thanks,

Michael

  2. Re: Decimal Point   Reply   Report abuse  
Picture of Arturs Sosins Arturs Sosins - 2012-02-21 08:21:56 - In reply to message 1 from Michael Turnbull
Do you mean since dot can not be used as a file name?

Well provided numbers are only example, so probably you should create your own image font graphics with dot image.

Then as dot can not be a file name, there are two options:

1. Use array to provide image paths, so you'd have something like:
$symbols = array(
"0" => "./digits/0.png",
"1" => "./digits/1.png",
...
"." => "./digits/dot.png"
);

2. If you want to provide images from directory, then you should use some character, that you aren't using in your alphabet, representing dot, for example letter d. Name graphic file containing dot as d.png and put it in graphic directory.

After that with each string value you want to apply image font, you firstly replace all dots with representing character:

$text = "123.123";

$new_text = str_replace(".", "d", $text); //will result in "123d123"

And then applying image font to text, all d occurencies will be replaced with dots from d.png file.

Hope that helps ;)