Code playground -> Some functions don't work (e.g. imagecreatetruecolor). | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 20

Code playground -> Some functions don't work (e.g. imagecreatetruecolor).

Does anyone know why? Some problem with the GD library? $image = imagecreatetruecolor(200, 200); $color = imagecolorallocate($image, 0, 0, 64); imagefill($image, 0, 0, $color); imagerectangle($image, 0, 0, 200, 200, $color); Header('Content-type: image/png'); imagepng($image); Output: Fatal error: Uncaught Error: Call to undefined function imagecreatetruecolor() in ..\Playground\:4 Stack trace: #0

5th Sep 2018, 12:08 AM
kdc
kdc - avatar
2 Answers
+ 16
Thanks!
5th Sep 2018, 7:53 PM
kdc
kdc - avatar
+ 10
PHP images *do* work, but sometimes the gd extension isn't loaded (in this case I show what extensions loaded): https://code.sololearn.com/wJQ7QO3k7KOX/?ref=app Note, you can't send headers from PHP here and there's an output glitch with normal base64; I use a 'safe' encoding to deliver the data to the app.
5th Sep 2018, 2:05 AM
Kirk Schafer
Kirk Schafer - avatar