Installing GD2 on Linux and Windows
PHP: GD2 Not installed:|| File and or directory is invalid
First you may be wondering what GD2 is… the official explanation is this “GD is an open source code library for the dynamic creation of images by programmers.” If you have ever come across this error it is probably because you have not installed the GD2 extension in PHP when you first setup your server. So I will let you know how install it in Linux and Windows.
Under Linux: The easiest way is to use your package manager to install it. For example in Debian… “apt-get install php5-gd” or Redhat… “—with-libdir=lib64 —with-gd —with-jpeg-dir —with-png-dir
Under Windows: You will have to download the .tar archive because the binary doesn’t include any extensions. So first make sure that in the “C:\PHP\ext” direct that you see “php_gd2.dll” if you do not see you will have to download it. You can obtain a copy by downloading the PHP5 .tar. Next you have to open your “php.ini” file search for “Dynamic Extensions” and just under that point PHP to the library file like this “extension=php_gd2.dll”
Note: make sure that your php.ini file is configured to look in the “C:\PHP\ext” folder for the extensions. Search in the file for “extension_dir”.
And there you have it you now have full GD2 support for PHP. You can now resize, scale, flip images on the fly.