Matt Posted May 6, 2011 Share Posted May 6, 2011 Hello everyone, I am currently writing a script that allows users to create a profile. They upload an image, and using Larry's code, it saves it in a folder outside the web directory. Because users could theoretically upload images of any width and/or height, I decided that I wanted to resize them during the upload to constrain their size. I found a highly recommended script by a guy named Mike Lopez that does exactly what I wanted (although it appears to be mainly for loading/resizing images from other URLs). The problem is that it was written in 2006, and the sparse documentation says that I must install the PHP GD extension to use the functions in the script (i.e. ImageCreateFromJPEG ($img)). I Googled PHP GD and found out that it was an extended library for manipulating image files. To further complicate things, I've also found out that there is a GD 2! The instructions on php.net say: To enable GD-support configure PHP --with-gd[=DIR] , where DIR is the GD base install directory. To use the recommended bundled version of the GD library (which was first bundled in PHP 4.3.0), use the configure option --with-gd . GD library requires libpng and libjpeg to compile. Do I still need to do this with PHP 5? It just seems like a lot of extra nonsense to do something as simple as manipulate image sizes! I am doing all my testing on a web host, so PHP GD might already be installed there. Does anyone have any experience with manipulating images with PHP or using PHP GD? Thanks for any help! Matt Link to comment Share on other sites More sharing options...
Jonathon Posted May 6, 2011 Share Posted May 6, 2011 Hi Matt, I fairly recently was playing around with some images and the GD library. I think you would need either GD library installed or PECLs Imagick. if you run phpinfo(); it will show you if it's installed. For instance this is my XAMPP read out: gdGD Support enabled GD Version bundled (2.0.34 compatible) FreeType Support enabled FreeType Linkage with freetype FreeType Version 2.3.11 T1Lib Support enabled GIF Read Support enabled GIF Create Support enabled JPEG Support enabled libJPEG Version 7 PNG Support enabled libPNG Version 1.2.40 WBMP Support enabled XBM Support enabled JIS-mapped Japanese Font Support enabled Hope that helps, if not or you need any further help pop back I'm sure someone will be able to help you 1 Link to comment Share on other sites More sharing options...
Matt Posted May 8, 2011 Author Share Posted May 8, 2011 Thanks Jonathon! I ran a info.php script on my host and it does show that GD is installed! Matt Link to comment Share on other sites More sharing options...
Jonathon Posted May 8, 2011 Share Posted May 8, 2011 Cool, Then your good to go! Good luck Link to comment Share on other sites More sharing options...
Recommended Posts