|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #80640 imagecreatetruecolor returns GDimage object instead of resource
Submitted: 2021-01-18 10:29 UTC Modified: 2021-01-18 11:48 UTC
From: petzold dot mx at gmail dot com Assigned:
Status: Verified Package: GD related
PHP Version: 8.0Git-2021-01-18 (snap) OS: debian
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2021-01-18 10:29 UTC] petzold dot mx at gmail dot com
From manual page:
returntype Change with php8 is not mentioned

imagecreatetruecolor returns an GdImage Object instead of a resource

Test script:
$image = imagecreatetruecolor(10,10);

if (!is_resource($image)) { 
die('Unable to generate image: not a resource'); 

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2021-01-18 11:48 UTC]
-Package: *Programming Data Structures +Package: GD related
 [2021-01-18 11:48 UTC]
Indeed, that is not documented in the manual proper; only the
migration guide notes the resource to object migration[1].

[1] <>
 [2021-01-18 11:48 UTC]
-Status: Open +Status: Verified
 [2021-01-26 05:03 UTC] tararamos19957 at gmail dot com
This little function will clone an image resource while retaining the alpha $clone = imagecreatetruecolor($w, $h); imagealphablending($clone, false); the Clone!! imagecopy($clone, $img, 0, 0, 0, 0, $w, $h); return $clone; } image resource, just copies bitmap-canvas to another new resource-object.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu May 06 09:01:24 2021 UTC