SOLVED::Images not uploading 2.8.3 with errors

Hi,

I’ve a site that is failing to upload images via the Media Browser or using the Gallery plugin. I can upload directly on the server to the media folders. This only started happening a few weeks ago.
When uploading via the Media browser the success message appears but the images is not actually uploaded.
When uploading via the Gallery extra I get an error “Please specify a file to upload.”
I wonder if anyone could help decipher some of the error messages i’m getting in the hope they have some bearing on the issue.
I’m running MODX 2.8.3, PHP 7.4.28

[2022-04-04 16:55:15] (ERROR @ /home2/myWebsite/public_html/core/xpdo/om/xpdoobject.class.php : 240) Error HY000 executing statement: 
Array
(
    [0] => HY000
    [1] => 3685
    [2] => Illegal argument to a regular expression.
)

[2022-04-04 16:55:15] (ERROR in resource 1 @ /home2/myWebsite/public_html/core/model/modx/modparser.class.php : 1373) Bad link tag `[[~40]]` encountered
[2022-04-04 16:57:19] (ERROR @ /home2/myWebsite/public_html/core/model/modx/modx.class.php : 1037) `` is not a valid integer and may not be passed to makeUrl()
[2022-04-04 16:57:32] (ERROR @ /home2/myWebsite/public_html/core/model/modx/modx.class.php : 1037) `` is not a valid integer and may not be passed to makeUrl()
[2022-04-04 16:57:44] (ERROR @ /home2/myWebsite/public_html/core/model/modx/modx.class.php : 1037) `` is not a valid integer and may not be passed to makeUrl()
[2022-04-04 16:59:25] (ERROR @ /home2/myWebsite/public_html/core/model/modx/modx.class.php : 1037) `` is not a valid integer and may not be passed to makeUrl()
[2022-04-04 17:01:53] (ERROR in modProcessor::run @ /home2/myWebsite/public_html/core/model/modx/modprocessor.class.php : 185) Flat file processor support, used for action web/phpthumb with path /home/myWebsite/public_html/core/components/gallery/processors/web/phpthumb.php, is deprecated since version 2.7.0. 
[2022-04-04 17:02:08] (ERROR @ /home2/myWebsite/public_html/core/model/phpthumb/modphpthumb.class.php : 165) phpThumb was unable to generate a thumbnail for: /home2/myWebsite/public_html/core/cache/phpthumb/www.starnarrowboatholidays.co.uk__srcd0eee549a67203a6ae87c5c6a8482623_pare23411d0821ae56bf50a1f79d182c074_dat1579194071.png
[2022-04-04 17:02:08] (ERROR @ /home2/myWebsite/public_html/core/model/phpthumb/modphpthumb.class.php : 177) Error outputting thumbnail:
OutputThumbnail() failed because !is_resource($this->gdimg_output) in file "phpthumb.class.php" on line 647
[2022-04-04 17:02:12] (ERROR @ /home2/myWebsite/public_html/core/model/phpthumb/modphpthumb.class.php : 165) phpThumb was unable to generate a thumbnail for: /home2/myWebsite/public_html/core/cache/phpthumb/www.starnarrowboatholidays.co.uk__srcfd6dc1904559f0ceb2429ce4cb3997d4_pare23411d0821ae56bf50a1f79d182c074_dat1413191923.png
[2022-04-04 17:02:12] (ERROR @ /home2/myWebsite/public_html/core/model/phpthumb/modphpthumb.class.php : 177) Error outputting thumbnail:
OutputThumbnail() failed because !is_resource($this->gdimg_output) in file "phpthumb.class.php" on line 647
[2022-04-04 17:02:56] (ERROR in xPDO::getService @ /home2/myWebsite/public_html/core/xpdo/xpdo.class.php : 1235) modRestClient::__construct is deprecated since version 2.3.0. Use the modRest classes instead.
[2022-04-04 17:02:56] (ERROR in modRestCurlClient::__construct @ /home2/myWebsite/public_html/core/model/modx/rest/modrestcurlclient.class.php : 26) modRestClient::__construct is deprecated since version 2.3.0. Use the modRest classes instead.

Thank you for any help

I don’t think any of these error messages are related to the unsuccessful image upload.

What has changed on the server since the time it worked?

Maybe it’s a problem with ModSecurity (a firewall).

May be a simple fix and sometimes work is to re-install Modx (same version) in case there are some paths or something corrupted inside, some times manipulation brake stuff.
Other thing is to check if have been changes in the hosting, upgrades of any kind, that sometimes affect the functionality.
Check the phpthumb or pthumb extra for updates, delete cache folder, thy again and let us know if that helps.

Cheers!
:grin:

Thanks both:-)
I’ve been so used to using Bobray’s Upgrade extra I just want to check that I’m going to be upgrading correctly by manually uploading the files.
Do I extract the zip files to another folder and copy/merge the following: Setup, Manager, Core, Connectors and index,php but not the config.core.php?

What I usually do is unzip the MODX archive locally, open that folder, then select all the files inside the folder and zip those together. I upload this new zip file to the MODX directory on the server, then when I unzip there, all the files go in the right place. Then, run /setup. I find this easier than unzipping the main MODX file on the server and then have to move/merge the files there.

An easy way to do this with UpgradeModx is to go into the system settings and change “settings_version” to the previous version (e.g., 2.8.2-pl). Then, UpgradeModx will show 2.8.3 as an upgrade option, so you can use it do download and reinstall 2.8.3.

Those errors look like deprecated warnings. You may want to turn off “log_deprecated” in the system settings so your error log doesn’t fill up with these.

For me, seeing what looks like a successful upload, but the file doesn’t appear, has always been because of a file size upload limit.

You should check the file size max upload setting in PHP. Sometimes a server update (like updating the version of PHP) resets this to a small amount, like 2MB, making uploading larger images fail. You can check this in MODX by going to Manage->Reports->System Info and clicking the “View” link to the right of “phpinfo()”. Look for the setting “upload_max_filesize”. If this size is small, either make it larger if you have access to that setting in your hosting control panel, or else request an increase from the hosting company. I set mine to 128MB. “post_max_size” affects how much can be sent through forms, so this also affects editing in the Manager. Make it at least 32MB.

MODX also has its own file size upload system setting, “upload_maxsize”. I’m not sure what the default is, but you can stick a zero or two onto the end of it to increase the allowed size.

Excellent tip, I normally do that manually but this is going to be my new strategy.
Thanks! :+1:

Very good point, putting this in the .htaccess file should solve the problem!

# Custom PHP values
<IfModule php5_module>
   php_value post_max_size 128M
   php_value upload_max_filesize 128M
</IfModule>

:+1:

Thanks all very much.

Re-installing solved that issue with uploading images. Still couldn’t get the Gallery extra to work and upload images even though it’s worked fine for a long time, but have now replaced that with another option.

@snowcreative That is a great solution for re-installing.Thanks for sharing.