Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - gooberlx

Pages: [1]
1
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.

Code: [Select]

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;
}

Code: [Select]

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().

Code: [Select]

  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.

2
making some headway:

i get only this now:
Code: [Select]

Error uploading image file:
103_0335.jpg: Image size invalid


with the max res at 600x600 and quality at 85 (ImageMagick), I find it hard to believe that this file is over 300K.  :?

Anyway, I'm gonna hit the sack.

3
I have found a hack around it by commenting out the errors added and forcing '1' for $ok where the code checks for image size, width and height.

It must not have been resizing the image before those checks.

Alas, I'm not very good with perl or php, so I'm kinda stumbling through this via trial and error.  :oops:

4
I've done a little debugging and made sure the code was going through the new loop. I'm assuming that the resizing should be done before check_image_size() is called?

check_image_size() is only called for non-ADMIN users, I see, and the picture turns out to be too big because it must not have been resized yet?

Any suggestions? I've double-checked all the files and could swear they're correct.

here's my resizing snippet, I don't see anything wrong.
Code: [Select]

//--------------------------------------------
//--------- Auto Image Resizing --------------
//--------------------------------------------
if ($config['auto_image'] && !$uploaderror) {
if ($direct_upload) {
$src = MEDIA_PATH."/".$cat_id."/".$new_name;
}
else {
$src = MEDIA_TEMP_PATH."/".$new_name;
}
$do_resize = 0;
if ($image_info = @getimagesize($src)) {
if ($image_info[2] == 1 || $image_info[2] == 2 || $image_info[2] == 3) {
$do_resize = 1;
}
}
if ($do_resize) {
if (!function_exists(init_convert_options)) {
require(ROOT_PATH.'includes/image_utils.php');
}
if ($image_info[0] > $config['max_image_width'] || $image_info[1] > $config['max_image_height']) {
$convert_options = init_convert_options();
if (!$convert_options['convert_error']) {
$quality = (intval($config['auto_image_quality']) && intval($config['auto_image_quality']) <= 100) ? intval($config['auto_image_quality']) : 100;
if (!resize_image($src, $quality, $config['max_image_width'], 1)) {
$msg .= (($msg != "") ? "<br />" : "")."<b>".$lang['file_upload_error'].": ".$new_name;
$uploaderror = 1;
}
}
}
}
}
//-------------------------------------------
if (!$uploaderror) {
      $additional_field_sql = "";
      $additional_value_sql = "";


The problem occurs with both portrait and landscape pics (if that helps).

5
Mods & Plugins (Releases & Support) / still no go
« on: April 11, 2003, 06:14:01 AM »
Well, I rechecked the file and everything seems to be right.

Code: [Select]

    $this->max_width['thumb'] = $config['max_thumb_width'];
    $this->max_width['media'] = $config['max_image_width'];
    $this->max_height['thumb'] = $config['max_thumb_height'];  
    $this->max_height['media'] = $config['max_image_height'];
    $this->auto_image['media'] = $config['auto_image']; <--------------

    $this->max_size['thumb'] = $config['max_thumb_size'] * 1024;
    $this->max_size['media'] = $config['max_media_size'] * 1024;

    $this->upload_mode = $config['upload_mode'];
    $this->lang = $lang;

    $this->set_allowed_filetypes();
  }

function check_image_size() {
    $this->image_size = @getimagesize($this->upload_file);
    $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']);
    }
    if ($this->auto_image[$this->image_type]) { <------------
      $ok = 1; <----------------------------------------------------
    } <--------------------------------------------------------------
    return $ok;
}

6
Mods & Plugins (Releases & Support) / regular users can't upload?
« on: April 11, 2003, 04:40:03 AM »
I'm having a problem with the normal users uploading. Admin can upload and autoresize works fine, but if a regular user tries then i get:

Code: [Select]
Error uploading image file:
IMG_0594.JPG: Image size invalid
IMG_0594.JPG: Image width invalid
IMG_0594.JPG: Image heigth invalid


file size is set to 300K
images size is 600x600

the admin user was able to upload this very image perfectly. And after upload the resized image conforms more than perfectly to my settings.

any suggestions?

Pages: [1]