hmmmm, still the same problem. Here's how that whole section looks, and then where it's called: Somewhere $ok must be getting set to 0. But if that were true then certainly one of the other error messages should have be printed out.
function check_image_size() {
$this->image_size = @getimagesize($this->upload_file);
if ($this->auto_image[$this->image_type] == 1) {
return 1;
}
$ok = 1;
if ($this->image_size[0] > $this->max_width[$this->image_type]) {
$ok = 0;
$this->set_error($this->lang['invalid_image_width']);
}
if ($this->image_size[1] > $this->max_height[$this->image_type]) {
$ok = 0;
$this->set_error($this->lang['invalid_image_height']);
}
return $ok;
}
if ($user_info['user_level'] != ADMIN) {
if (!$this->check_max_filesize()) {
$this->set_error($this->lang['invalid_file_size']);
$ok = 0;
}
if (eregi("image", $this->HTTP_POST_FILES[$this->field_name]['type'])) {
if (!$this->check_image_size()) {
$ok = 0;
}
}
}
So it seems the problem must be coming from check_max_filesize(), which would make sense since we're not resizing it until after that.
What I've done is copy that new "if" section and put it right after check_max_filesize().
function check_max_filesize() {
if ($this->auto_image[$this->image_type] == 1) {
return 1;
}
if ($this->HTTP_POST_FILES[$this->field_name]['size'] > $this->max_size[$this->image_type]) {
return false;
}
else {
return true;
}
}
But I still had to leave the new "if" statement in check_image_size(), otherwise I'd get invalid width and height again. So currently it works, and both check_image_size() and check_max_filesize() have that new "if" statement, but it still feels like a hack for some reason; like fixing a house with ducted-tape.