S
S
Sergey Miller2021-01-27 16:04:44
MODX
Sergey Miller, 2021-01-27 16:04:44

Modx api runsnippet run snippet in file?

There is a form on the site, when submitting Ajax sends data to php for verification. Trying to call a phpthumbof

php snippet

<?php
// Подключаем modx api
define('MODX_API_MODE', true);
require $_SERVER['DOCUMENT_ROOT'].'/index.php';

....

$options = "w=100&h=100&zc=1&far=C&q=95";
$image = $_SERVER["REQUEST_SCHEME"] . '://' . $_SERVER["SERVER_NAME"].'/user_upload/'.$fileName; // тут все правильно
$userImage = $modx->runSnippet('phpthumbof', array('input' => $image, 'options' => $options)); // комментируя эту строку никаких ошибок не появляется

echo json_encode(['error' => '<img src="'.$userImage.'" alt="">'], JSON_UNESCAPED_UNICODE);
exit;
....


Error occurs when submitting
{"readyState":4,"responseText":"","status":500,"statusText":"error"}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Miller, 2021-02-03
@blackseabreathe

Decided!
Install phpthumbsup and run it in the runSnippet command

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question