If like me you use the WordPress plugin Resize at Upload, or Resize at Upload Plus, it’s quite likely that you’ll be getting a mysql error when changing the settings.  Something like:


Access denied for user ''@'localhost' (using password: NO) in /home/accountname/public_html/wp-content/plugins/resize-at-upload/resize-upload.php on line 63

And seeing as the plugins seem to be abandoned with no updated for many years, you may be mistaken in thinking you’ll need to source an alternative.  Not so.  Fortunately the fix is relatively simple.

From your WordPress Dashboard go to Plugins > Editor and select the Resize and Upload (or Plus) plugin from the top-right dropdown.  Now, in the resize-upload.php file, scroll down and find the section that looks like the code below:

/* the real option page */
function hz_uploadresize_options(){
 if (isset($_POST['hz_options_update'])) {
 $maxwidth = trim(mysql_real_escape_string($_POST['maxwidth']));
 $yesno = $_POST['yesno'];

To fix your problem, you’ll need to replace the line that starts with $maxwidth= to the following:

$maxwidth = trim( esc_sql($_POST['maxwidth']) );

If you’re using the Plus version you will also have a maxheight variable, so you’ll need to apply the same fix as follows:

$maxheight = trim( esc_sql($_POST['maxheight']));

The problem is that the mysql_real_escape_string() command is deprecated and needs an active MySQL connection to work.  Apply those fixes and the plugin will continue to work as intended.