What are the potential reasons for the error "Call to undefined function imagecreate()" in the PHP code snippet provided?
The error "Call to undefined function imagecreate()" occurs when the GD library, which is required for image manipulation functions in PHP, is not enabled or installed on the server. To solve this issue, you need to ensure that the GD library is enabled in your PHP configuration or install it if it's missing.
// Check if the GD library is enabled
if (!function_exists('imagecreate')) {
die('GD library is not enabled');
}
// Your image manipulation code here