hosted by liquidweb


Go Back   Web Hosting Talk : Web Hosting Main Forums : Programming Discussion : php progress
Reply

Programming Discussion Discussions related to web programming languages and other related issues. Topics may include configuration, optimization, practical usage and database connectivity.
Forum Jump

php progress

Reply Post New Thread In Programming Discussion Subscription
 
Send news tip View All Posts Thread Tools Search this Thread Display Modes
  #1  
Old 03-19-2003, 08:29 PM
summcat summcat is offline
Junior Guru
 
Join Date: Aug 2002
Posts: 214

php progress


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.

Reply With Quote


Sponsored Links
  #2  
Old 03-20-2003, 12:38 AM
harmonic harmonic is offline
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.
Reply With Quote
  #3  
Old 03-20-2003, 01:04 AM
harmonic harmonic is offline
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

Reply With Quote
Sponsored Links
  #4  
Old 03-20-2003, 03:58 PM
summcat summcat is offline
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?

Reply With Quote
  #5  
Old 03-20-2003, 04:10 PM
Umbongo Umbongo is offline
Web Hosting Master
 
Join Date: Jan 2003
Posts: 674
Code:
<img src="bar.php?current=23.97&max=700" />

Reply With Quote
  #6  
Old 03-20-2003, 05:29 PM
Rich2k Rich2k is offline
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

Reply With Quote
  #7  
Old 03-20-2003, 06:33 PM
cyansmoker cyansmoker is offline
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?

__________________
http://www.voilaweb.com - the Social Internet Toolbox.

Reply With Quote
  #8  
Old 03-20-2003, 07:18 PM
summcat summcat is offline
Junior Guru
 
Join Date: Aug 2002
Posts: 214
oh, yes, i can.

Reply With Quote
Reply

Related posts from TheWhir.com
Title Type Date Posted
Government Cloud Consolidation Tops IT Predictions for 2013: IDC Report Web Hosting News 2012-12-07 16:17:20
New Bill Would Require Federal Agencies to Report Cloud Computing Progress Web Hosting News 2012-10-01 15:49:26
The Green Grid Releases New Research, Training Tools on Data Center Energy Efficiency Web Hosting News 2012-03-07 14:30:22
Web Host Secure Cloud Space Integrates Softaculous Auto-Installer with Control Panel Web Hosting News 2011-12-19 16:39:33
Building Clouds – Where’s the Money At, with Hexagrid’s Joseph Seibel Web Hosting News 2011-09-27 15:10:05


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:
Web Hosting News:



 

X

Welcome to WebHostingTalk.com

Create your username to jump into the discussion!

WebHostingTalk.com is the largest, most influentual web hosting community on the Internet. Join us by filling in the form below.


(4 digit year)

Already a member?