Loading modx 3 images

Hello. There was a problem with loading images. Appeared today. No changes have been made to the site. Checked in two browsers. The hosting provider checked their problem is not reproducible and the download is carried out. I don’t have. Such a window freezes.

The output from the “Console” tab in the browser developer tools (that is shown in your screenshot) is not very helpful.

Can you change to the “Network” tab and check what request exactly creates the problem? What is the response of this request?

Uploading: 2023-10-02_183605.png…

This screenshot doesn’t tell me much.
There is a list of requests at the bottom of the screenshot. Search the one that returns HTML instead of JSON (and therefore causes the error).

What is the exact action you perform when the error appears? Are you trying to select an image for a template variable?

these files are now gone

I’m uploading an image

Open the developer tools first and go to the “Network” tab.
Then try to upload the image.
The generated requests should appear in the list (again).
Select them (one by one) in the list and check the response. (The one that creates the problem probably has the “action” parameter = Browser/File/Upload).

So it’s probably the one with the Название = index.php?fileapi1696... (or maybe another one with index.php).

Click on the request and look at the response.

What’s in the response? Is it HTML instead of JSON?

other JSON index.php

In the screenshot you posted above, you are on the tab “Заголовки”. Can you go to “Ответ” instead!


<b>Fatal error</b>
:  require_once() [<a href='0function.require0'>function.require0</a>
]: Failed opening required '/home/n/noreplzh/noreplzh.beget.tech/public_html/core/model/phpthumb/phpthumb.class.php' (include_path='.:/usr/share/php') in <b>/home/n/noreplzh/noreplzh.beget.tech/public_html/core/cache/includes/elements/modx/revolution/modplugin/34.include.cache.php</b>
on line <b>5</b>

So the Plugin with the ID = 34 generates a fatal error?

In the manager → tab “Elements” (“Элементы”), scroll down to the “Plugins” (“Плагины”) section and check what plugin has the ID = 34. (You may have to open the folders to see the ID that is in round brackets after the plugin name). From what extra is this plugin?

// проверяем нужное событие
if ($modx->event->name != 'OnFileManagerUpload') {return;}
// подключаем phpthumb
require_once MODX_CORE_PATH.'model/phpthumb/phpthumb.class.php';
// настройки плагина
$config = array(
 'assets/upload/folder1/' => array(
   'src' => array('w' => 800,'h' => 600,'zc' => 1,'bg' => '#fff','q' => 90),
 'assets/upload/folder2/' => array(
   'src' => array('w' => 400,'h' => 300,'zc' => 1,'bg' => '#fff','q' => 90),
   'thumb' =>array('w' => 200,'h' => 150,'zc' => 1,'bg' => '#fff','q' => 70),
// параметры загружаемого файла
$file = $modx->event->params['files']['file'];
$directory = $modx->event->params['directory'];
// получаем media source
$ms = $modx->event->params['source'];
if($ms == null){
// настройки media source
$msProperties = $ms->get('properties');
$directory = $msProperties['basePath']['value'].$directory;
// на всякий случай проверяем наличие // и заменяем на /
$directory = str_replace('//', '/', $directory);
// смотрим, что при загрузке не возникло ошибок
if ($file['error'] != 0) {
$name = $file['name'];
$extensions = explode(',', $modx->getOption('upload_images'));
// проверям, что наша категория задана в настройках плагина
if (array_key_exists($directory, $config)) {
 $config = $config[$directory];
else {
// путь к файлу, имя файла, расширение
$filename = MODX_BASE_PATH.$directory.$name;
$def_fn = pathinfo($name, PATHINFO_FILENAME);
$ext = pathinfo($name, PATHINFO_EXTENSION);
// проверяем, что расширение файла задано в настройках MODX, как изображение
if (in_array($ext, $extensions)) {
 $sizes = getimagesize($filename);
 $format = substr($sizes['mime'],6);
 // бежим по всем полям массива с конфигом
 foreach($config as $imgKey =>$imgConfig){
   $options = '';
   if($imgKey == 'src'){
     // для ключа src имя файла совпадает с исходным
     $imgName = $filename;
     // формируем имя файла
     //$imgName = MODX_BASE_PATH.$directory.$def_fn.'.'.$ext.'.'.$imgKey.'.'.$ext;
     $imgName = MODX_BASE_PATH.$directory.$def_fn.'_'.$imgKey.'.'.$ext;
   // создаем объект phpThumb..
   $phpThumb = new phpThumb();
   // ..и задаем параметры
   foreach ($imgConfig as $k => $v) {
     $phpThumb->setParameter($k, $v);
   // генерируем файл
   if ($phpThumb->GenerateThumbnail()) {
     if ($phpThumb->RenderToFile($imgName)) {
     // устанавливаем права на файл, это опционально, зависит от сервера
     chmod($imgName, 0666);

The extra ResizeImageOnUpload is very old and this path only works on MODX 2.x.
If you really need to use this extra with MODX 3, then take a look at this thread:

thank you.disabled it. I do not know what it is installed for