|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
php image gen
I have a counter that displays the count in the form of 5 image files which show the counter on the respective number. Right now i just set the five gifs beside eachother and it looks very unprofessional for them all to load at diferent times, is there a way in php to put each of these five images together into one long image that would represent the whole number?
Thanks! |
|
#2
|
||||
|
||||
|
You can store it in a Java applet (not sure if it works) but you can also try to code (or find) some JavaScript which does the job...
More info on PHP image generation: http://www.phpbuilder.com/columns/rasmus19990124.php3 http://www.phpbuilder.com/columns/allan20000830.php3 http://www.phpbuilder.com/columns/w...er20001218.php3 |
|
#3
|
|||
|
|||
|
Rather than build a complicated script to glue together the image files, why not make use of the GD library to dynamically create the whole image, complete with the numbers? It would be a very simple script, and with that method, you have the freedom to switch between any number of fonts and styles quickly.
The only difficulty can be setting up your server to integrate GD with PHP, but once you do that, GD is very fast and efficient. I don't see how Javascript would do the job, other than possibly pre-loading all the images, and then making them appear at the same time.
__________________
The real n-tier system: FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL Amazon wishlist -- rycamor (at) gmail.com |
|
#4
|
|||
|
|||
|
I'm not sure I understand what "GD" means.
I am assuming you mean for me to have php create the entire graphic with its image generation capabilities. Is it possible to add special effects (such as making the numbers appear on fire or making an outline around each number etc.) with php? thanks! |
|
#5
|
|||
|
|||
|
GD is the name of the image generation package in PHP
|
|
#6
|
|||
|
|||
|
Go to http://php.net/image for more info.
PHP with GD can do some fairly standard outlines, dropshadows, etc... and if you set it up with TTF support, you can actually drop any of your windows True-Type fonts on the server, to be used in images. GD supports stuff like line drawing, polygons, curves, fills, blends, image layering and transparency (sort of), and text scaling and antialiasing, and output to PNG or Jpeg, among others. If you want special effects like flames, etc... then you should create a small flame background that is the appropriate size, and you can layer it under the fonts. If you want the flame to model the actual text, though, you should consider just creating small premade images for each number. GD is not intended for effects like that, because they take too much processing power. If you really want to do it dynamically, you can use Gimp to do special server-side effects. (see www.cooltext.com for an example). I do not recommend this for something like a counter, though, because your server will take a beating. There is also a new image library for PHP called php_imlib, which has some more advanced features than GD, but I haven't tested it yet. |
|
#7
|
||||
|
||||
|
Rycamor:
Letting the images appear at the same time: that's exactly the goal that must be achieved. I don't know what is the easiest or the best way, but JavaScript can do the job. About GD: I've heard about how great GD is, and I saw some "kewl" examples, but when your hosting company doesn't support it, like mine ("We will consider installing it, when we get more requests") you can't use it. You can check if GD is installed by making a php file with the following content: PHP Code:
I am not an expert on GD, but links the articles on PHPbuilder I posted should help you. There is lots of info on GD (www.boutell.com/gd/ ). If you are seriously interested in PHP you might want to buy a book on it, like "Beginning PHP" from the publisher Wrox, this book has a chapter on image generation. You can find more info about PHP books elsewhere in this forum and on the web (try http://forums.devshed.com/showthrea...13460&forumid=5). Bizzk |
|
#8
|
|||
|
|||
|
There is a graphics program that is commonly installed on Unix servers: ImageMagick.
If you read the comments on http://php.net/image, you will see a couple of comments about using passthru() to generate a graphic with ImageMagick and output it to the browser. It's not integrated with PHP, but since PHP can just call it from the command-line you can accomplish many of the same tasks with it. If you have a shell account on the server, you might even be able to install ImageMagick yourself, if it's not already there. Yeah, Javascript can do the job, but php guy seemed to be looking for a PHP solution. |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > PHP Development > php image gen |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|