Reply
How is this SIMPLE script made?
Old 04-16-2007, 02:01 PM How is this SIMPLE script made?
feraira's Avatar
BeTheBand!

Posts: 313
http://www.camorraworld.org/layout-s....php?rating=87

I'd like to implement a feature like that onto my current project. Any idea's on how it is done?
__________________
www.alldrumtabs.com
feraira is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
Old 04-16-2007, 02:21 PM Re: How is this SIMPLE script made?
Republikin's Avatar
Super Moderator

Posts: 3,191
Do you mean a rating bar or a system to rate a specific thing? Details would help.
Republikin is offline
Reply With Quote
View Public Profile
 
Old 04-16-2007, 02:26 PM Re: How is this SIMPLE script made?
feraira's Avatar
BeTheBand!

Posts: 313
A rating bar just as it is there. Like you give it a value through the URL and it will show the adequate value.
__________________
www.alldrumtabs.com
feraira is offline
Reply With Quote
View Public Profile
 
Old 04-16-2007, 04:31 PM Re: How is this SIMPLE script made?
Republikin's Avatar
Super Moderator

Posts: 3,191
There are a couple of ways to go about it. The simplest is to create separate images for each stage (stage 1 with 1 bar, 2 with 2 bars, etc) then do a simple if/else control structure on the variable $_GET['rating'].

Are you familiar at all with PHP? Or better yet, what language are you using for your current project?
Republikin is offline
Reply With Quote
View Public Profile
 
Old 04-16-2007, 04:43 PM Re: How is this SIMPLE script made?
feraira's Avatar
BeTheBand!

Posts: 313
Most PHP. I have been coding for quite a while.

But if you have noticed (played around with the one i sent you), you can put ANY value at the end (Between 0 and 100) and it'll change accordingly.

I understand that this is done with "image" within PHP, to create a PNG file. But then how is the bar created on this PNG file?
__________________
www.alldrumtabs.com
feraira is offline
Reply With Quote
View Public Profile
 
Old 04-16-2007, 06:12 PM Re: How is this SIMPLE script made?
Republikin's Avatar
Super Moderator

Posts: 3,191
It is not necessarily done by dynamically creating the image, infact, I personally would consider that a bit overkill. Since the total value of the bar would be 100 and that bar has 6 tabs (that person seems to divide them in half as well so the actual number would be 12), I would just create that many images and call them up based upon number ranges...

PHP Code:
<?php

if($_GET['rating'] <= 8) {
// echo out the image that corresponds to this level
}elseif($_GET['rating'] > && <= 16) {
// I think this makes the point clear enough
}

?>
In this way you can avoid all the extra coding that comes with rendering images, not to mention the problems with png in IE.
Republikin is offline
Reply With Quote
View Public Profile
 
Old 04-16-2007, 06:24 PM Re: How is this SIMPLE script made?
feraira's Avatar
BeTheBand!

Posts: 313
Quote:
Originally Posted by Republikin View Post
It is not necessarily done by dynamically creating the image, infact, I personally would consider that a bit overkill. Since the total value of the bar would be 100 and that bar has 6 tabs (that person seems to divide them in half as well so the actual number would be 12), I would just create that many images and call them up based upon number ranges...

PHP Code:
<?php

if($_GET['rating'] <= 8) {
// echo out the image that corresponds to this level
}elseif($_GET['rating'] > && <= 16) {
// I think this makes the point clear enough
}

?>
In this way you can avoid all the extra coding that comes with rendering images, not to mention the problems with png in IE.
OK, Thanks very much.

Off to watch Serenity now!
__________________
www.alldrumtabs.com
feraira is offline
Reply With Quote
View Public Profile
 
Old 04-16-2007, 08:14 PM Re: How is this SIMPLE script made?
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
Wireless Audio
Posts: 2,322
Name: Keith Marshall
Location: West Hartford, CT
I think it might be made by merging a few png images together (one for overlay and one for color) that output a final image using the GD Image lib.

I would probably create that as the green representing the rating percentage, with the block overlay on top to create the "blocks" look.
__________________

<mgraphic /> - I don't have a solution but I admire the problem.
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 04-17-2007, 07:49 PM Re: How is this SIMPLE script made?
Average Talker

Posts: 25
I personally wouldn't use the GD library (maybe because I don't know it that well) but I'd just output some separate bars depending on the amount inputted using some simple if-elseif-else conditions.
Faster load time (the images are cached and used multiple times), and simpler (at least for me :P).
ryogo is offline
Reply With Quote
View Public Profile
 
Old 04-17-2007, 09:52 PM Re: How is this SIMPLE script made?
feraira's Avatar
BeTheBand!

Posts: 313
Quote:
Originally Posted by ryogo View Post
I personally wouldn't use the GD library (maybe because I don't know it that well) but I'd just output some separate bars depending on the amount inputted using some simple if-elseif-else conditions.
Faster load time (the images are cached and used multiple times), and simpler (at least for me :P).
I like the idea.

But the bar on that page i linked to is just quite.. amazing. It will fit to any given percentage. I am intrigued on how it works though,,,
__________________
www.alldrumtabs.com
feraira is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to How is this SIMPLE script made?
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.17979 seconds with 12 queries