master82 Posted March 9, 2006 Share Posted March 9, 2006 Hello again people,I've set up a HTML (which includes PHP coding). On the page I have a section called progress which retrieves data from mySQL and displays a percentage as to a users progress.I was wondering if I could also do this graphically using PHP by having a simple bar image (bar.png) that expands depending upon the percentage.As the image is a pixel or so wide I was hoping that I could simply change the width of the .png image using PHP code, setting the width to the percentage [ie 50% would make the bar width 50 pixels wide or something like that](Hope I said that right - something like all those online games you see with health bars etc) Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/4543-image-resize/ Share on other sites More sharing options...
AndyB Posted March 9, 2006 Share Posted March 9, 2006 Like this, perhaps?[code]<?php$pct = 50; // percent complete retrieved 'somehow' ?><img src="bar.png" height="10" width="<?php echo $pct;?>" alt=""/>[/code] Quote Link to comment https://forums.phpfreaks.com/topic/4543-image-resize/#findComment-15848 Share on other sites More sharing options...
master82 Posted March 9, 2006 Author Share Posted March 9, 2006 It works!Thanks for the help, cant believe it was something so simple - so simple I overlooked it lol Quote Link to comment https://forums.phpfreaks.com/topic/4543-image-resize/#findComment-15850 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.