• [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 589967 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
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #450 on: October 02, 2010, 06:41:28 PM »
use ImageMagick
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 haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #451 on: December 07, 2010, 07:24:43 AM »
Hi..is it only for resizing images or it also auto resize the thumbnails..

Please reply..looking forward to it..

Regards
Haider.

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: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #452 on: December 08, 2010, 01:33:20 AM »
It's only for images, not thumbnails.
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 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: [Mod] Auto image resize on upload v2.0 (2010-12-12)
« Reply #453 on: December 12, 2010, 09:00:23 PM »
Step 1
In new version 2 added thumbnails resize.
To upgrade do the following:

Open member.php find:
//--- End Auto Image Resizing ----------------

Insert above:above::
    if ($config['auto_thumbnail'] && !$uploaderror)
    {
      if (
$direct_upload)
      {
        
$src THUMB_PATH."/".$cat_id."/".$new_name;
      }
      else
      {
        
$src THUMB_TEMP_PATH."/".$new_name;
      }
      
$do_resize 0;
      if (
$image_info = @getimagesize($src))
      {
        if (
$image_info[2] > && $image_info[2] < && $image_info[0] > $config['max_thumb_width'] || $image_info[1] > $config['max_thumb_height'])
        {
          if (!
function_exists("init_convert_options"))
          {
            require(
ROOT_PATH.'includes/image_utils.php');
          }
          
$convert_options init_convert_options();
          if (!
$convert_options['convert_error'])
          {
            
$quality intval($config['auto_image_quality']);
            
$quality = ($quality >= && $quality <= 100) ? $quality 85;
            if (!
resize_image($src$quality$config['max_thumb_width'], 1$config['max_thumb_height']))
            {
              
$msg .= (($msg != "") ? "<br />" "")."<b>".$lang['file_upload_error'].": ".$new_name;
              
$uploaderror 1;
            }
          }
        }
      }
    }


Step 2
Open includes/upload.php

Find:
    $this->auto_image['media'] = $config['auto_image'];

Insert below:below::
    $this->auto_image['thumb'] = $config['auto_thumbnail'];
« Last Edit: December 18, 2010, 07:08:02 PM by V@no »
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 haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: [Mod] Auto image resize on upload v2.0 (2010-12-12)
« Reply #454 on: December 12, 2010, 11:23:51 PM »
can you please also add one more feature in to it ...that it also auto resize the Avatar too to the defined width and height in ACP??
it will b a great feature..scince then users wont gonna need PhotoShop, or image resizer software to auto resize image and upload it ..

now if user upload avatar bigger then the size difined in ACP..it gives error..but i guess auto resize in avatar will be really great feature..

Offline x23piracy

  • Sr. Member
  • ****
  • Posts: 420
    • View Profile
    • FHG
Re: [Mod] Auto image resize on upload v2.0 (2010-12-12)
« Reply #455 on: December 13, 2010, 09:08:31 AM »
Hi,

is it possible to let me choose if width or height is taken for resizing?
If the resizing is made by width the height may differs to the other pictures,
that brings a bad look für categorie view for me.
(thumbs not on a line, different height).

So for me it would be better if the resizing can be made by max height given in ACP.
Could that be an option?

Another way should be to resize for given max width and then another resize to
max height by holding proportion.

I think the best solution is to choose a setting for that:

- resize by max width given by acp
- resize by max height given by acp
- resize by max width, then by max height given by acp


Greetz X23

Don't trust in md5 it's unsafe change your 4i galerys password hash algorythm! second pw db field, create new hashes over some time, deny old hash. Help members that cry, send informationen mail to the rest. Camouflage new pw hash in cookie. Done!

--(◔̯◔)--

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: [Mod] Auto image resize on upload v2.0 (2010-12-12)
« Reply #456 on: December 13, 2010, 02:44:51 PM »
so what happens when you set max widht/height to the same value?
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 haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: [Mod] Auto image resize on upload v2.0 (2010-12-12)
« Reply #457 on: December 15, 2010, 11:59:29 AM »
My image auto resize is not working..
Yes thumbanail is auto resizing but how to make it working for auto resize the image??

it gives me error when i upload image of bigger then the size defined in the ACP??

Code: [Select]
Error uploading image file:
db_systems.jpg: Image width invalid
db_systems.jpg: Image heigth invalid

shouldn't it is suppose to auto resize?? or we have to some changes in ACP to make it auto resizable?


you can see in the attached screen shot..

please reply how to make it autoresizable?


=================================================

ok. i found a new thing..i mean..when i login from my admin account..it resize the image..but when i upload image from normal user account..it gives me this problem..i think there is restriction on user that user cant upload size more than the specified size in ACP??

how to fix this problem?
« Last Edit: December 15, 2010, 01:50:47 PM by haider512 »

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: [Mod] Auto image resize on upload v2.0 (2010-12-12)
« Reply #458 on: December 15, 2010, 02:13:22 PM »
double check step 2.2, it's below, not above ;)

P.S.
just updated the instructions, replaced $ok with "1", shouldn't matter above or below anymore.
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 haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: [Mod] Auto image resize on upload v2.0 (2010-12-12)
« Reply #459 on: December 15, 2010, 02:28:53 PM »
double check step 2.2, it's below, not above ;)

P.S.
just updated the instructions, replaced $ok with "1", shouldn't matter above or below anymore.

hi..

thanks again for reply..
should i do check the step 2.2 or should i replace $ok.. if i do replace the $ok with 1 then i wont have to check the step 2.2 right??


====================


ok it was already below..but i changed it from "return $ok;to "return 1;"..but no use??

still im having the size problem..the auto resize not working for normal users..??

This is some of coding i changed in upload.php..

Code: [Select]
function Upload() {
    global $config, $lang;

    $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->auto_image['thumb'] = $config['auto_thumb'];
    $this->max_width['avatar'] = $config['avatar_width'];
    $this->max_height['avatar'] = $config['avatar_height'];

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

    $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->auto_image[$this->image_type]) {
      return 1; //auto image is on, don't need check for anything else.
    }

    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;
  }
« Last Edit: December 15, 2010, 02:46:58 PM by haider512 »

Offline haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Need Help with Auto Image resize on upload mod
« Reply #460 on: December 17, 2010, 02:43:49 AM »
Hi i need help..i cant figure out that how to fix the problem..i also did posted in the respective mod topic but still issue is not solved yet..so will appreciate anyone help me out..

Actually it is a great mod..infact awesome one..and im very happy to have this mod..and this mod is working fine but for the admin (me).
it auto resize image and thumbnails both if i do it from admin account..

but from normal regular user account when i try to upload a image it gives me error of that image and height is invalid the the image is bigger then the resolution that i have set in admin..

now instead it should b doing auto resizing..it should not giving me problem of image height and width..it should auto resize the image to the defined size and height in ACP...

it works for admin for not for user..

here is the post i have already asked for help..
http://www.4homepages.de/forum/index.php?topic=7700.msg154211#msg154211

it is really great mod...and i do really love to have this mod..


Please any one fix this issue/bug for me..

Looking forward to your help..please..

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: [Mod] Auto image resize on upload v2.0 (2010-12-12)
« Reply #461 on: December 17, 2010, 04:02:01 AM »
and did you enable auto resize in the config?
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 haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: [Mod] Auto image resize on upload v2.0 (2010-12-12)
« Reply #462 on: December 17, 2010, 02:41:22 PM »
and did you enable auto resize in the config?

i dont know may be its enabled..please tell me where in ACP to enable it..

this is settings screenshot in ACP...

Offline henary

  • Jr. Member
  • **
  • Posts: 73
    • View Profile
Re: [Mod] Auto image resize on upload v2.0 (2010-12-12)
« Reply #463 on: December 17, 2010, 02:55:50 PM »
Hello,

i think you did't do step 4  :wink:

Regards,
Henry

Offline haider512

  • Full Member
  • ***
  • Posts: 153
    • View Profile
Re: [Mod] Auto image resize on upload v2.0 (2010-12-12)
« Reply #464 on: December 17, 2010, 05:40:21 PM »
Hello,

i think you did't do step 4  :wink:

Regards,
Henry

Thanks.. for letting me know..yes i fixed it now..and you can see in the thumbnail now..i did the step 4..

but still that restriction problem isn't solved..im still having that problem..and image resize is enabled..


please reply how to fix this problem..please please..looking forward to your replies.....

Best Regards
Haider.


==================================

i think it has something to do with this coding but i am not sure now..


Code: [Select]
function check_image_size() {
    $this->image_size = @getimagesize($this->upload_file);
    $ok = 1;

    if ($this->auto_image[$this->image_type]) {
      return 1; //auto image is on, don't need check for anything else.
    }

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

 im stucked in coding.. all i know to remove coding so it should not check size and width lolz..but still dont know will it gonna work or not..

any how.. please reply... im stucked up in these codings..


=========================================================


wow i just figured out one more thing..your mod is doing great regarding to resizing images..
i mean when regular users upload images bigger then the sized defined in admin then it resize them..

but its the thumbnail which is giving error to regular users regarding to size and height..

and the step 2.2 ...i guess its for image resizing not for thumbnail resizing..
i think you should make some more changes in your coding for thumbnails too so users dont get problem when they upload thumbnails bigger then the size defined in admin section..

rest you mod is doing great..and its awesome mod..

as you have inserted auto thumbnail resize feature later..so i guess you forgot to add the code for thumbnail that it should not give error when trying to upload bigger image then defined and it should auto resize it..


Please loook in to this matter and im still looking forward to help...

please..
« Last Edit: December 17, 2010, 07:13:49 PM by haider512 »