Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#51174 closed defect (bug) (fixed)

wp 5.6 missing function is_gd_image

Reported by: backups's profile BackuPs Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 5.6 Priority: normal
Severity: normal Version: 5.6
Component: Media Keywords:
Focuses: Cc:



In wordpress 5.6 i get this error

Uncaught Error: Call to undefined function is_gd_image() in /var/docs/server.tst/public/wp-includes/media.php:3475
Stack trace:

The function does not seem to exists and there is no check added before calling it.

Thank you for creating with WordPress.

You are using a development version (5.6-alpha-48899).

Please provide a fix

Change History (7)

#1 @BackuPs
4 years ago

it seems to happen calling this function wp_imagecreatetruecolor()

if i change the code is_gd_image back to is_resource then it works fine.

f.e. if you add this into the theme functions.php you get the error.

$newimage = wp_imagecreatetruecolor( $width, $height );

Last edited 4 years ago by BackuPs (previous) (diff)

#2 @SergeyBiryukov
4 years ago

  • Component changed from General to Media
  • Keywords reporter-feedback added
  • Milestone changed from Awaiting Review to 5.6

Thanks for the report!

The function was added in [48798] / #50833.

As noted in comment:7:ticket:50833, while some media functions can be called on front end, is_gd_image() is currently only defined in the admin, and should probably be available on front end too.

Could you share some details about how you're using wp_imagecreatetruecolor()? Is it for image creation or editing on front end?

Last edited 4 years ago by SergeyBiryukov (previous) (diff)

#3 @BackuPs
4 years ago


Yes we have a buildin image resizing that kicks in while users load a page in the front end and or resize their screens.

Please consider adding the function is_gd_image() also for the wordpress front-end

Thank you

#4 @SergeyBiryukov
4 years ago

  • Keywords needs-patch added; reporter-feedback removed
  • Owner set to SergeyBiryukov
  • Status changed from new to accepted

That helps, thanks :)

#5 follow-up: @BackuPs
4 years ago

Thank you for accepting

Please let me know once it has been added to the front-end so i can reinstall 5.6 again and continue testing with the dev wordpress.

Have a great weekend !

#6 @SergeyBiryukov
4 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 48905:

Media: Make the is_gd_image() function available on front end.

This avoids a fatal error if a plugin calls image creation or editing functions like wp_imagecreatetruecolor() outside of the admin.

Follow-up to [48798]

Props BackuPs.
Fixes #51174. See #50833.

#7 in reply to: ↑ 5 @SergeyBiryukov
4 years ago

  • Keywords needs-patch removed

Replying to BackuPs:

Please let me know once it has been added to the front-end so i can reinstall 5.6 again and continue testing with the dev wordpress.

This is now addressed in [48905]. You too have a great weekend :)

Note: See TracTickets for help on using tickets.