| 3:27 pm on Mar 21, 2003 (gmt 0)|
Here is a great reference for PHP [php.net] image [php.net] functions. There is a thumbnail creation example in the user notes.
| 4:25 pm on Mar 21, 2003 (gmt 0)|
Thanks for the rapid response, Birdman! Yes, I had found that referenc in the PHP manual. I'm a *relative* newbie to PHP scripting (I've put up half-a-dozen simple db based sites thus far). This site is on an outside host so I don't control the server. Is the "GD library" mentioned in the manual something that has to be pre-installed in the configuration on the server, or can I install it within my "account" on this host to get this to work?
| 4:51 pm on Mar 21, 2003 (gmt 0)|
on the server, your host would have to set it up for you if it isn't already.
You could always try gd_info() [php.net] or phpinfo() [php.net]
| 4:58 pm on Mar 21, 2003 (gmt 0)|
louponne, if your hosting service doesn't have PH with GD installed, you cannot install install it yourself (unless you've admin access to the server).
the PHP functions using GD are very powerful and allow you to do lots of things once you manage to understand their use.
It's not always obvious at the begininning, but looking at the examples will help you.
I don't recommand you use on-the-fly image generation, especially with large files because it will put a high load on the server, and it is unnecessary to re-create thumbnails again all the time. Your jpeg files aren't going to change at every request!
I have a website with a photo album. After I've uploaded new pictures, I run a script that creates and saves to disk thumbnails for all new pictures. The same script is run once a day by night, in case I forgot to create some thumbnails.
| 5:04 pm on Mar 21, 2003 (gmt 0)|
AFAIK the GD support has to be configured during PHP installation.
Just try a simple GD function -- if you get no error but a result, everything should work fine.
You may also try a <?php phpinfo();?> which will show you a long list of all features and parameters of the PHP on your server.
If you will find a '--with-gd=yes' in the 'Configure command' section, then you should be OK.
| 5:34 pm on Mar 21, 2003 (gmt 0)|
Thanks to all for your help thus far!
I just made a test.php with just gd_info(); in it and got
Fatal error: Call to undefined function: gd_info()...
So it looks like this host does not have this installed. :(
| 6:51 pm on Mar 21, 2003 (gmt 0)|
louponne, from the documentation of the gd_info() function, you can see that it only works with PHP 4.3.0 and better.
The error you got is a PHP error meaning that the function gd_info() is not defined. It doesn't tell whether GD is installed or not!
Run phpinfo(). It should work, and give you some info :
- PHP version
- if GD is installed or not
This is not as good as gd_info() but rather usefull anyway
Don't forget the documentation :
| 8:03 pm on Mar 21, 2003 (gmt 0)|
oops - thanks for correcting me and many thanks for your patience with a relative newbie! Yes, I ran phpinfo() as you suggested. PHP 4.1.2 and gd is indeed "enabled". hurray. Now all I have to do is learn how to use it! Many thanks again for everyone's help!
| 10:50 pm on Mar 21, 2003 (gmt 0)|
I just posted a script in Bag-O-Tricks for PHP II [webmasterworld.com] that you may like to check out.
[edited by: coopster at 5:41 pm (utc) on Mar. 19, 2007]
[edit reason] fixed link [/edit]