Change 1: Please, open qa-include/util/image.php with a text editor and replace this line of code:
if (is_resource($inimage)) {
with this one:
if (is_resource($inimage) || $inimage instanceof \GdImage) {
on line 96 and line 105
Because of this issue, resizing of images won’t work either so please, apply the following to changes as well.
Change 2: In qa-include/util/image.php, place the text cursor on line 157 and replace:
if (is_resource($newimage)) {
with this:
if (is_resource($newimage) || $newimage instanceof \GdImage) {
and save any change.
Change 3: open qa-include/app/upload.php and replace this line of code:
if (is_resource($image)) {
with this one:
if (is_resource($image) || $image instanceof \GdImage) {
on line 153, line 165, and line 174 (Note: remove the opening curly brace in this last case) and save any change.
This link will take you to a page with all these changes in just one place.
According to this PHP Watch’s article, "From PHP 8.0 and forward, GD extension uses \GdImage class objects instead of resources for its underlying data structures." And fortunately, this change is also backward compatible.
Tidbits
By the way, what is GD extension used for?
When PHP is compiled with the GD extension, PHP can also transform images. PHP’s official documentation (as of this writing) says “It can also be used to create and manipulate image files in a variety of different image formats, including GIF, PNG, JPEG, WBMP, and XPM. Even more conveniently, PHP can output image streams directly to a browser.”
In the case of Question2Answer, GD extension is used for:
* and also resizing images as per the `Maximum size for storing avatars (in pixels)` option that is available under `Admin` → `Users`.
And you, what do you use the GD extension for? Leave your comments below
I hope it is useful.