Bitcoin Forum

Economy => Services => Topic started by: OgNasty on June 23, 2015, 11:56:31 PM



Title: USD to BTC Pricing Image Script (configurable size, colors)
Post by: OgNasty on June 23, 2015, 11:56:31 PM
USD to BTC Pricing Image Script:

We have made available a configurable script courtesy of nonnakip (https://bitcointalk.org/index.php?action=profile;u=69046) at http://dev.nastyfans.org in the "Nasty Tools" section that allows you to price things in USD and it is converted to an image showing the BTC amount.  Samples below showing the script options.


http://langrock.org/stats/btcval.png?usd=500&size=15&bg=dddddd&fg=006600
Code:
http://langrock.org/stats/btcval.png?usd=500&size=15&bg=dddddd&fg=006600

or more simply...

http://langrock.org/stats/btcval.png?usd=500
Code:
http://langrock.org/stats/btcval.png?usd=500


Title: Re: USD to BTC Pricing Image Script (configurable size, colors)
Post by: coinableS on June 24, 2015, 12:05:52 AM
That's cool! Did you do this with PHP's imagettftext(); ??
This could be useful for bloggers posting on their site or even here at the forum using the IMG tags.
It auto updates right? Each time the PNG is called it grabs the current market rate and re-renders the image?


Title: Re: USD to BTC Pricing Image Script (configurable size, colors)
Post by: OgNasty on June 24, 2015, 12:15:26 AM
It auto updates right? Each time the PNG is called it grabs the current market rate and re-renders the image?

Yes.


Title: Re: USD to BTC Pricing Image Script (configurable size, colors)
Post by: mattjack on June 24, 2015, 01:47:40 AM
If you'd like a script with more options and more accurate exchange rate without the begging for a donation, try this:
$25 = http://langrock.org/stats/btcval.png?usd=25&size=12&bg=eeeeee&fg=000000
$35 = http://langrock.org/stats/btcval.png?usd=35&size=12&bg=eeeeee&fg=000000
$15 = http://langrock.org/stats/btcval.png?usd=15&size=12&bg=eeeeee&fg=000000

Script courtesy of NastyFans and options to use it can be found at http://dev.nastyfans.org in the "Nasty Tools" section.

Bro I just wanna say that this jab at TBZ in another thread made my day  :D


Title: Re: USD to BTC Pricing Image Script (configurable size, colors)
Post by: MystPhysX on June 24, 2015, 02:08:06 AM
Where does it scrape the conversion rate from?

Also this is awesome, thanks.


Title: Re: USD to BTC Pricing Image Script (configurable size, colors)
Post by: OgNasty on June 24, 2015, 03:29:59 AM
Where does it scrape the conversion rate from?

Bitstamp, I believe.


Title: Re: USD to BTC Pricing Image Script (configurable size, colors)
Post by: Razerglass on June 24, 2015, 03:36:33 AM
Where does it scrape the conversion rate from?

Bitstamp, I believe.

nice script I will use this :)


Title: Re: USD to BTC Pricing Image Script (configurable size, colors)
Post by: icanscript on June 24, 2015, 03:47:04 AM
work for other currencies? eur, gbp?


Title: Re: USD to BTC Pricing Image Script (configurable size, colors)
Post by: OgNasty on June 24, 2015, 03:48:37 AM
work for other currencies? eur, gbp?

No.  Just USD.  :-[


Title: Re: USD to BTC Pricing Image Script (configurable size, colors)
Post by: icanscript on June 24, 2015, 03:57:48 AM
Open source at all? Id be happy to add that functionality.


Title: Re: USD to BTC Pricing Image Script (configurable size, colors)
Post by: OgNasty on June 24, 2015, 04:00:58 AM
Open source at all? Id be happy to add that functionality.

No.  This script was designed for a single purpose a long time ago.  I just thought I'd post it here since it seemed to have been forgotten.


Title: Re: USD to BTC Pricing Image Script (configurable size, colors)
Post by: icanscript on June 24, 2015, 04:02:05 AM
Open source at all? Id be happy to add that functionality.

No.  This script was designed for a single purpose a long time ago.  I just thought I'd post it here since it seemed to have been forgotten.

ah, well a great script anyway :) Thanks for the share.


Title: Re: USD to BTC Pricing Image Script (configurable size, colors)
Post by: amacar1 on June 24, 2015, 12:16:05 PM
Open source at all? Id be happy to add that functionality.

I have similar script, but it is more powerfull (check below for extra parameters), will put it on github when will have time or can sell it to you very cheap.

I made this: http://amacar.hostei.com/generateImage/index.php/?VALUE=10&CUR=USD&TYPE=24h_avg&TIMESTAMP=YES&PRECISION=7&COLOR=00FFFFD&SIZE=12&FONT=calibri

Link is:
Code:
[img] http://amacar.hostei.com/generateImage/index.php/?VALUE=10&CUR=USD&TYPE=24h_avg&TIMESTAMP=YES&PRECISION=7&COLOR=00FFFF&SIZE=12&FONT=calibri [/img]

Parameter VALUE is just amount you want to convert to BTC
Parameter CUR is currency and could be any value from: https://bitcoinaverage.com ('USD', 'EUR', 'GBP', 'CAD'...), default is USD.
Parameter TYPE could be 'ask', 'bid', '24h_avg', 'last', default is last.
If parameter TIMESTAMP is 'yes', then timestamp is added to image, otherwise no. Default is no timestamp added.
Parameter PRECISION allows you to round calculated value to decimals. Default is 5.
Parameter COLOR will change text color. Accept HEX values, default is black.
Parameter SIZE is size of text, default is 11.
FONT is font of text, default is arial.

Currently supported fonts (can add more):
https://i.imgur.com/1A8moBf.png


Title: Re: USD to BTC Pricing Image Script (configurable size, colors)
Post by: coinableS on June 24, 2015, 12:29:26 PM
Open source at all? Id be happy to add that functionality.

I have similar script, but it is more powerfull...[snip]

You should create your own thread. It's kind of rude to hijack someone else's thread and post your stuff and call it better. Not cool.


Title: Re: USD to BTC Pricing Image Script (configurable size, colors)
Post by: Emerge on June 24, 2015, 03:37:20 PM
Great work OgNasty!

just my BTChttp://langrock.org/stats/btcval.png?usd=0.02

Perfect. works like a charm