
03-19-2003, 08:29 PM
|
|
Junior Guru
|
|
Join Date: Aug 2002
Posts: 214
|
|
Hello everybody-
I need to make a really simple progress bar. I have a dollar countup until 700 dollars are reached. I need to make a php script that lets me enter my progress out of 700, then it generates a progress bar. this progress bar needs to be link bar.php, so i can link to it in forums as an image. How should i do this? an admin panel is not really needed, id be glad to just edit the source when it changes.
thanks, and money is available if this is too hard.
|

03-20-2003, 12:38 AM
|
|
WHT Addict
|
|
Join Date: Jul 2002
Posts: 117
|
|
[edit]
I'll get it done ASAP.
[/edit]
Is black and grey okay?
Tell me colors if you need them..
Last edited by harmonic; 03-20-2003 at 12:50 AM.
|

03-20-2003, 01:04 AM
|
|
WHT Addict
|
|
Join Date: Jul 2002
Posts: 117
|
|
Code:
<?
// EDIT THESE
$current = "412"; // CURRENT NUMBER OF WHATEVER
$goal = "700"; //GOAL
$length = "300"; // NUMBER OF PIXELS FOR THE BAR TO BE...
// DONT EDIT ANYMORE
header ("Content-type: image/png");
$percent = $current / $goal;
$percent = intval($percent * 100);
$total = $percent * ($length / 100);
$im = imagecreate($length, 50);
$grey = imagecolorallocate($im, 204, 204, 204);
$black = imagecolorallocate ($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 300, 50, $grey);
imagestring($im, 3, 5, 5, $percent."%", $black);
imagefilledrectangle($im, 0, 25, $total, 50, $black);
imagepng($im);
?>
Hope its cosmetically appealing enough, I can make it use different colors if you want... or have a border..
It works fine for me though. Im not gonna ask to be payed but i always accept tips if you insist
You can just edit $current to keep the image updated
|

03-20-2003, 03:58 PM
|
|
Junior Guru
|
|
Join Date: Aug 2002
Posts: 214
|
|
ive got www.xstreamhost.com/~youngh/bar.phps , but since the scripts action is it's self, the bar cannot be displayed on forums. how can i get it to generate a bar so it can be displayed on a forum?
|

03-20-2003, 04:10 PM
|
|
Web Hosting Master
|
|
Join Date: Jan 2003
Posts: 674
|
|
Code:
<img src="bar.php?current=23.97&max=700" />
|

03-20-2003, 05:29 PM
|
|
Web Hosting Master
|
|
Join Date: May 2002
Location: UK
Posts: 2,994
|
|
Of course you must have GD compiled with PNG support for that to work 
|

03-20-2003, 06:33 PM
|
|
Web Hosting Master
|
|
Join Date: Oct 2001
Location: California, USA
Posts: 1,315
|
|
Quote:
Originally posted by summcat
ive got www.xstreamhost.com/~youngh/bar.phps , but since the scripts action is it's self, the bar cannot be displayed on forums. how can i get it to generate a bar so it can be displayed on a forum?
|
Summcat, I think you're on the right way; less work for the server, and it's easier to code 
I am not sure I quite understand your comment, though?
Can't you put this <img tag between a <a href.. /a>; couple tags?
|

03-20-2003, 07:18 PM
|
|
Junior Guru
|
|
Join Date: Aug 2002
Posts: 214
|
|
oh, yes, i can. 
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
| Postbit Selector |
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
| Login: |
|
|
| Advertisement: |
|
|
| Web Hosting News: |
|
|
|