Discussion on:
View:
Show:
Okay, so what other PHP graphics tips do readers have out there? Other PHP imaging add-ons we should cover, other tips and techniques you'd like to share?
The author said, "The values range from 0 to 250...If you want to use values between 0 and 100...all you need to do is multiply the value by 25..."
Multiply the value in the percentage range by 2.5, not 25. If the value is still in decimal form (ie., 0.5 signifying 50%) then multiply by 250.
Multiply the value in the percentage range by 2.5, not 25. If the value is still in decimal form (ie., 0.5 signifying 50%) then multiply by 250.
How about showing how to use PHP to dynamicly load .jpg's into Flash movies. And also in doing so limit viewrs ability to drag and drop those .jpg's to there desk top or even decompile the SWF in order to get the .JPG.
That is outside the scope of this article.
james@mail.toyboxxprod.com wrote:
How about showing how to use PHP to dynamicly load .jpg's into Flash movies. And also in doing so limit viewrs ability to drag and drop those .jpg's to there desk top or even decompile the SWF in order to get the .JPG.
james@mail.toyboxxprod.com wrote:
How about showing how to use PHP to dynamicly load .jpg's into Flash movies. And also in doing so limit viewrs ability to drag and drop those .jpg's to there desk top or even decompile the SWF in order to get the .JPG.
How about dynamically creating images with text in them? I know it can be done, but I've never looked up how to do it. Is there a call you can put in for that, or is manually loading images, or...?
rexb@cnet.com wrote:
Okay, so what other PHP graphics tips do readers have out there? Other PHP imaging add-ons we should cover, other tips and techniques you'd like to share?
rexb@cnet.com wrote:
Okay, so what other PHP graphics tips do readers have out there? Other PHP imaging add-ons we should cover, other tips and techniques you'd like to share?
The answer could be found in the PHP image functions link at the end of the article.
Example 1. PNG creation with PHP
This example would be called from a page with a tag like: . The above button.php script then takes this "text" string and overlays it on top of a base image which in this case is "images/button1.png" and outputs the resulting image. This is a very convenient way to avoid having to draw new button images every time you want to change the text of a button. With this method they are dynamically generated.
Example 1. PNG creation with PHP
This example would be called from a page with a tag like: . The above button.php script then takes this "text" string and overlays it on top of a base image which in this case is "images/button1.png" and outputs the resulting image. This is a very convenient way to avoid having to draw new button images every time you want to change the text of a button. With this method they are dynamically generated.
Hey, thanks for sharing that. I'm beginning to understand why Yahoo went with PHP as their primary page generation engine.
Is there a way to specify the font attributes in which the text
gets generated?
gets generated?
Image caching is important for images created from information that will remain static for any length of time.
Image creation is an oft overused feature of PHP. Every developer I've known who learned about it went overboard with ideas without thinking about the consequenses.
Images such as graphs should be created and stored in a folder on the server. When a user requests the page containing the graphic, the file's modified date should be checked and the image updated if needed. Even if you do this every 5 minutes, it's better than recreating the image each time the page is requested.
The PHP function for checking the modified date of a file is 'filemtime(filename)'. Be sure to read the PHP documentation for the use of filemtime(), it's results are cached and you should understand how it works before using it in your scripts.
Image creation is an oft overused feature of PHP. Every developer I've known who learned about it went overboard with ideas without thinking about the consequenses.
Images such as graphs should be created and stored in a folder on the server. When a user requests the page containing the graphic, the file's modified date should be checked and the image updated if needed. Even if you do this every 5 minutes, it's better than recreating the image each time the page is requested.
The PHP function for checking the modified date of a file is 'filemtime(filename)'. Be sure to read the PHP documentation for the use of filemtime(), it's results are cached and you should understand how it works before using it in your scripts.
I have used the graphs as outlined here and they work really well. Managed to build the code with lots of variables and now I have a good graphs "library" that I can reuse on lots of projects (so thankyou....).
What I would like to do is make the coloured bar charts slightly sexier (eg, colour fading/shadowing like in Powerpoint or Excel). People come to expect this kind of gloss now and I find it makes people head towards MS products rather than Open Source....
Is there a way to do it in php? I guess the most obvious way would be some kind of repeating image to make a pattern....
What I would like to do is make the coloured bar charts slightly sexier (eg, colour fading/shadowing like in Powerpoint or Excel). People come to expect this kind of gloss now and I find it makes people head towards MS products rather than Open Source....
Is there a way to do it in php? I guess the most obvious way would be some kind of repeating image to make a pattern....
I would like to be able to number the grid on the x and y axis. Is there a way to do this? I am a super novice at programming and PHP is my first venture.
How can I post more than one line on a single graph? (a comparison of two lines)
Thanks!
Jack
PS...part of my project requires making several mortgage calculators: payment, rent-vs-buy, qualifying. do you have any sources for ready made code that might do this? or an article on how to perfom this? I'm using the charting function above to graph the results of a mortgage payment with and without an additional principle payment...
How can I post more than one line on a single graph? (a comparison of two lines)
Thanks!
Jack
PS...part of my project requires making several mortgage calculators: payment, rent-vs-buy, qualifying. do you have any sources for ready made code that might do this? or an article on how to perfom this? I'm using the charting function above to graph the results of a mortgage payment with and without an additional principle payment...
Hi!
Very goo article on creating a line or a bar chart, and i found it very usefull. However the is something very important missing. X and Y Labels!
How would you do it and how could it be dinamic according to the values on the chart?
Thank you!
Hugo
Very goo article on creating a line or a bar chart, and i found it very usefull. However the is something very important missing. X and Y Labels!
How would you do it and how could it be dinamic according to the values on the chart?
Thank you!
Hugo
- Keyboard Shortcuts:
- Prev
- Next
- Toggle









































