• [Mod] Auto image resize on upload v2.0.1 (2010-12-18) 4 0 5 1
Currently:  

Author Topic: [Mod] Auto image resize on upload v2.0.1 (2010-12-18)  (Read 590345 times)

0 Members and 2 Guests are viewing this topic.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] Auto image resize on upload.
« Reply #45 on: May 14, 2003, 07:59:24 PM »
do they get any errors, or the image just go through with the original size?
can u resize images from ACP?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline sookes

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • http://www.deliasdesign.com
oops but still not always working
« Reply #46 on: May 14, 2003, 09:30:14 PM »
Caveat to all who come after - make sure the file you are trying to upload is not corrupted!  

I went back to test it all again and this time uploaded a different file.  It worked with an image that was only 400 pixels wide. I have the max size set to 300.

I then tried to upload another jpg from the same first group of large pictures 900 x 900 and it says this:

Marjorie.jpg: Image size invalid
Marjorie.jpg: Image width invalid
Marjorie.jpg: Image heigth invalid

I even took the image into Fireworks and reexported as a jpg to make sure the file was okay.

Is there any size restrictions in the program itself? Or could this be a server or time out problem?

The folks who will be doing the uploads aren't knowledgeable enough to reduce these scanned files and digital camera images.  Need to be able to deal with the larger files if possible.

Thanks for your help, my fellow Georgian!

Offline andersen

  • Newbie
  • *
  • Posts: 34
    • View Profile
[Mod] Auto image resize on upload.
« Reply #47 on: May 15, 2003, 08:37:43 AM »
Quote from: sookes
I have spent 2 hours working on this.  I've redone it and checked to make sure I was using original files from the most recent version download.  The database is set up okay.

I've read through all the posts and have gained no illumination into what could go wrong.

The settings show up correctly in the control panel and can be manipulated there.

But no matter what I do, a user cannot upload a file over the specified max size.  It will not  resize the images.

I really like this and would like for it to work.

Any new ideas?


Ha!  :lol:

Your problem is my previous experience.

Please check your ImageMagick path, If you ImageMagick path is correctly problem will be solve.

P/s: Last time my mod on this, I waste a lot of time for setup and re-setup, everything is the ImageMagick path made the problem, try to use the most compatible ImageMagick path. Ask you host, and test all path on process.

Good Luck
What's wrong, huh?

Offline sookes

  • Newbie
  • *
  • Posts: 13
    • View Profile
    • http://www.deliasdesign.com
using gd with resizer
« Reply #48 on: May 15, 2003, 02:38:53 PM »
I wish for ImageMagick!  Doesn't come installed and I've looked at it and don't know that I can.  

Thanks anyway.

Offline beachgerl

  • Newbie
  • *
  • Posts: 14
    • View Profile
Parse error
« Reply #49 on: May 15, 2003, 10:10:18 PM »
I copied everything in the mod and followed the instructions to the tee. Then I logged in as a registered user and attempted to upload. Here is what happened: I kept getting this parse error on member.php line 513. I can't find anything that is missing? Here's the code I did on member.php:

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 (!fuction_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 != "") ? "" : "") ? "" : "")."<b>".$lang['file_upload_error'].": ".$new_name;
        $uploaderror = 1;
        }
        }
        }
        }
        }
//----------------------------------------


Other than that, the admin and install auto image settings seem to be fine. Or is it in other modified scripts?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
[Mod] Auto image resize on upload.
« Reply #50 on: May 15, 2003, 11:18:44 PM »
there is nothing wrong with this code.
what is on line 513?
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline beachgerl

  • Newbie
  • *
  • Posts: 14
    • View Profile
Line 513
« Reply #51 on: May 15, 2003, 11:57:05 PM »
I used Bbedit and the line 513 pointed at the new code I added from your code, starting with
Code: [Select]

if (!resize_image($src,... {
$msg.= (($msg !="")...


It came from the path .../member.php on line 513 parse error if I try to upload something. Is it this member.php or it comes from other scripts I modified?

Offline beachgerl

  • Newbie
  • *
  • Posts: 14
    • View Profile
Changed the mod - one error
« Reply #52 on: May 16, 2003, 09:31:57 AM »
I deleted the original mod of member.php and used this code instead:
Code: [Select]
//--------------------------------------------
//--------- Auto Image Resizing --------------
//--------------------------------------------
                  if ($config['auto_image'] && !$uploaderror) {
                     $src_copy = MEDIA_PATH."/".$cat_id."/big";
                     if ($direct_upload) {
                        $src = MEDIA_PATH."/".$cat_id."/".$new_name;
                        $src_copy = MEDIA_PATH."/".$cat_id."/big";
                    }
                    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');
                        }
                        $convert_options = init_convert_options();
        if (!$convert_options['convert_error']) {
if ($image_info[0] > $config['max_image_width'] || $image_info[1] > $config['max_image_height']) {
$result = true;
 if (!@is_dir($src_copy)) {
   $oldumask = umask(0);
   $result = mkdir($src_copy);
   umask($oldumask);
   if (!@is_dir($src_copy) || !$result) {
     $result = mkdir($src_copy, 0755);

   }
 }
if ($result == true){
copy($src, $src_copy."/".$new_name);
}
                     $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;
                        }
                    }
                  }else{
                  $do_resize = 0;
                  }
                      }
                     }
                  }
//-------------------------------------------


Now, the only errors are:
gwenstefani.jpg: Image width invalid
gwenstefani.jpg: Image heigth invalid

The upload code is:
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']; <------

 function check_image_size() {
    $this->image_size = @getimagesize($this->upload_file);
if ($this->auto_image[$this->image_type] == 1) {
return 1;
}    
$ok = 1;

 function check_max_filesize() {
if ($this->auto_image[$this->image_type] == 1) {
return true;
}    

if ($this->HTTP_POST_FILES[$this->field_name]['size'] > $this->max_size[$this->image_type]) {
      return false;
    }
    else {
      return true;
    }
  }


I've run the install_autoimage.php and lang mod which are ok.

I've set the Image max. width and height to 600px and 1000k for size.

What am I doing wrong here? Does this mod also auto resize the larger image sizes, not just thumbnails?

Also, in admin settings I noticed that both Auto-Image-Resizer and Auto-Thumbnailer, when clicked on, say the message: "Select module to create thumbnail. Check module settings." What does that mean?  

Thanks again!

Offline beachgerl

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: anyone who could solve this?
« Reply #53 on: May 18, 2003, 03:01:52 AM »
Anyone who could resolve this? Otherwise, I'd be forced to revert to original gallery scripts.

I'd appreciate it.

Thanks.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Changed the mod - one error
« Reply #54 on: May 18, 2003, 06:33:44 PM »
Quote from: beachgerl
What am I doing wrong here? Does this mod also auto resize the larger image sizes, not just thumbnails?
this mod doesnt have anything to do with thumbnails ;)

Quote from: beachgerl
Also, in admin settings I noticed that both Auto-Image-Resizer and Auto-Thumbnailer, when clicked on, say the message: "Select module to create thumbnail. Check module settings." What does that mean?

is your autothumnailer works at all?
"Select module to create thumbnail. Check module settings." means that u havent specifyed witch module do u want to use to create thumbnails or resize images (GD, ImageMagick or NetPBM)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline beachgerl

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re-coded the auto image upload
« Reply #55 on: June 04, 2003, 09:02:30 PM »
I'm back. Well, I still get parse error when I try to upload something as a regular user. I don't know why! Here's the code I re-typed in the member.php.

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 = ini_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;
}
}
}
}
}
//-------------------------------------------


The error message says:
"Parse error: parse error, expecting `']'' in /home/.../www/gallery/member.php on line 627"

What am I missing here? Can anyone see what's wrong with the code that I overlooked anything?

Thanks again for your assistance.

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
[Mod] Auto image resize on upload.
« Reply #56 on: June 04, 2003, 09:52:13 PM »
What exactly is on lines 626, 627 and 628?

Offline sito99

  • Pre-Newbie
  • Posts: 1
    • View Profile
I'm getting this error after installing this mod
« Reply #57 on: June 06, 2003, 08:48:41 PM »
Warning: Cannot modify header information - headers already sent by (output started at /home/friends/lang/english/admin.php:540) in /home/friends/admin/admin_functions.php on line 172

Any ideas?

Thanks,

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: I'm getting this error after installing this mod
« Reply #58 on: June 06, 2003, 09:21:35 PM »
Quote from: sito99
Warning: Cannot modify header information - headers already sent by (output started at /home/friends/lang/english/admin.php:540) in /home/friends/admin/admin_functions.php on line 172

Any ideas?

yep, read FAQ ;)
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline beachgerl

  • Newbie
  • *
  • Posts: 14
    • View Profile
[Mod] Auto image resize on upload.
« Reply #59 on: June 08, 2003, 07:57:21 PM »
Quote from: Chris
What exactly is on lines 626, 627 and 628?

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 = ini_convert_options();
if (!$convert_options['convert_error']) {  
$quality = (intval($config['auto_image_quality']) &&<---------------- line 626
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;
 }
 }
 }
 }
 }  
 //-------------------------------------------



I'd appreciate any help on this. I wonder if the problem lies in this member.php or upload.php?

Thanks again.