Answer the question
In order to leave comments, you need to log in
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;
....
{"readyState":4,"responseText":"","status":500,"statusText":"error"}
Answer the question
In order to leave comments, you need to log in
Decided!
Install phpthumbsup and run it in the runSnippet command
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question