Error Uploading Files

I have had an upload process built uploading pictures on the web server. All of a sudden my development machine (localhost) throws errors when attempting. What is interesting is the code works properly on the live web server?

Here is the debug error I’m getting.

{
“code”: 0,
“file”: “C:\xampp\htdocs\knights\dmxConnectLib\lib\image\Processor.php”,
“line”: 29,
“message”: “Call to undefined function lib\image\imagecreatefromstring()”,
“trace”: “#0 C:\xampp\htdocs\knights\dmxConnectLib\modules\image.php(36): lib\image\Processor->load(‘C:\\xampp\\htdocs…’, false)\n#1 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(197): modules\image->load(Object(stdClass), ‘image’, Array)\n#2 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(169): lib\App->execSteps(Object(stdClass))\n#3 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(137): lib\App->execSteps(Array)\n#4 C:\xampp\htdocs\knights\dmxConnectLib\modules\core.php(69): lib\App->exec(Object(stdClass), true)\n#5 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(197): modules\core->repeat(Object(stdClass), ‘repeat’, Array)\n#6 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(169): lib\App->execSteps(Object(stdClass))\n#7 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(137): lib\App->execSteps(Array)\n#8 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(126): lib\App->exec(Object(stdClass), false)\n#9 C:\xampp\htdocs\knights\dmxConnectLib\lib\App.php(104): lib\App->exec(Object(stdClass))\n#10 C:\xampp\htdocs\knights\dmxConnect\api\BE_act\images\insert.php(8): lib\App->define(Object(stdClass))\n#11 {main}”
}
Fatal error: Uncaught Error: Call to undefined function lib\image\imagedestroy() in C:\xampp\htdocs\knights\dmxConnectLib\lib\image\Processor.php:25
Stack trace:
#0 [internal function]: lib\image\Processor->__destruct()
#1 {main}
thrown in C:\xampp\htdocs\knights\dmxConnectLib\lib\image\Processor.phpon line25

Any idea what is wrong on my development machine? Thanks - Jim

Have a look at and following videos

Ben;

I did go through the suggested video and still experiencing the same problem. This problem only occurs on my development machine. It works fine on my production server.

Here is the error I’m experiencing after I click the save button. By the way the picture does download. So the error occurs after the download.

"code": 0,
"file": "C:\\xampp\\htdocs\\knights\\dmxConnectLib\\lib\\image\\Processor.php",
"line": 29,
"message": "Call to undefined function lib\\image\\imagecreatefromstring()",
"trace": "#0 C:\\xampp\\htdocs\\knights\\dmxConnectLib\\modules\\image.php(36): lib\\image\\Processor->load('C:\\\\xampp\\\\htdocs...', false)\n#1 C:\\xampp\\htdocs\\knights\\dmxConnectLib\\lib\\App.php(204): modules\\image->load(Object(stdClass), 'image', Array)\n#2 C:\\xampp\\htdocs\\knights\\dmxConnectLib\\lib\\App.php(176): lib\\App->execSteps(Object(stdClass))\n#3 C:\\xampp\\htdocs\\knights\\dmxConnectLib\\lib\\App.php(144): lib\\App->execSteps(Array)\n#4 C:\\xampp\\htdocs\\knights\\dmxConnectLib\\lib\\App.php(133): lib\\App->exec(Object(stdClass), false)\n#5 C:\\xampp\\htdocs\\knights\\dmxConnectLib\\lib\\App.php(111): lib\\App->exec(Object(stdClass))\n#6 C:\\xampp\\htdocs\\knights\\dmxConnect\\api\\BE_act\\golfers\\registration_sponser_new_22.php(8): lib\\App->define(Object(stdClass))\n#7 {main}"

}
Fatal error: Uncaught Error: Call to undefined function lib\image\imagedestroy() in C:\xampp\htdocs\knights\dmxConnectLib\lib\image\Processor.php:25
Stack trace:
#0 [internal function]: lib\image\Processor->__destruct()
#1 {main}
thrown in C:\xampp\htdocs\knights\dmxConnectLib\lib\image\Processor.phpon line25

Please let me know what I can do to correct the problem. Thanks - Jim

Have you got GD enabled?

For more, see:
https://www.php.net/manual/en/function.gd-info.php

We might be getting closer to the problem? I built a small page to execute the line of code requested. Here is what I built

<!doctype html>

<script src="../dmxAppConnect/dmxAppConnect.js"></script>

<meta charset="UTF-8">

<title>Untitled Document</title>

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous" />

<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/css/bootstrap.min.css" integrity="sha384-B0vP5xmATw1+K9KRQjQERJvTumQW0nPEzvF6L/Z6nronJ3oUOFUFpCjEUQouq2+l" crossorigin="anonymous" />

<link rel="stylesheet" href="../css/style.css" />
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js" integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN" crossorigin="anonymous"></script>

<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.0/dist/js/bootstrap.min.js" integrity="sha384-+YQ4JLhjyBLPDQt//I+STsc9iw4uQqACwlvpslubQzn4u2UU2UFM80nGisd026JF" crossorigin="anonymous"></script>

<?php

var_dump(gd_info());

?>

When executed here is what is returned:

Fatal error : Uncaught Error: Call to undefined function gd_info() in C:\xampp\htdocs\knights\admin\gd_test.php:21 Stack trace: #0 {main} thrown in C:\xampp\htdocs\knights\admin\gd_test.php on line 21

Thank you for your help. Jim

Not sure if that means that the problem is solved or not.

In any case, make sure that GD is enabled by going to php.ini and make sure that the line has not been commented out with a ; preceeding it.

The line was commented out. I removed the semi colon and rebooted the computer and it all works fine once again. Thank you for your support.

1 Like