VOOZH about

URL: https://www.geeksforgeeks.org/php/php-imagecreatefromgd-function/

⇱ PHP | imagecreatefromgd() function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

PHP | imagecreatefromgd() function

Last Updated : 30 Jan, 2020
The imagecreatefromgd() function is an inbuilt function in PHP which is used to create a new image from GD file or URL. Further, this image can be worked upon in the program. An image can be converted into GD format using the imagegd() function. Syntax:
resource imagecreatefromgd( string $filename )
Parameters:This function accepts a single parameter $filename which holds the name or URL of file. Return Value: This function returns an image resource identifier on success, FALSE on errors. Below given programs illustrate the imagecreatefromgd() function in PHP: Program 1 (Viewing a gd file in browser): Output:
This will load gd image in text form as it is not supported by browser.
Program 2 (Converting GD into png and viewing in browser): Output: 👁 Image
Program 3 (Converting GD into jpg): Output:
This will convert GD image into JPEG and save in local folder.
Reference: https://www.php.net/manual/en/function.imagecreatefromgd.php
Comment