• [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 517905 times)

0 Members and 1 Guest are viewing this topic.

Offline Guldstrand

  • Newbie
  • *
  • Posts: 41
    • View Profile
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #450 on: June 02, 2010, 02:06:58 AM »
How to use this mod with the Auto-Image-Resizer in admin?
I´ve already over 3000 images in my gallery, and i want to auto create intermediate images for them to.

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
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 Carpfish

  • Newbie
  • *
  • Posts: 23
    • View Profile
    • Carp-Photo-Portal
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #452 on: June 15, 2010, 08:32:08 AM »
Habe auch diesen Mod in verwendung und Funktioniert echt super...Thanks V@no
Zusätzlich habe ich noch den Highslide dazu.

Nur habe ein Problem, ich habe auch den Media Site´s Mode http://www.4homepages.de/forum/index.php?topic=24054.0 von V@no instaliert.
Ich bekomme zwar das Thumb, aber in der Detailseite sehe ich nichts.
Hat dies mit dem Images Resize Mode zu tun?
Vieleich kann mir wer helfen, habe im Moment ein zweites 4images mit Videos auf einer anderen Datenbank laufen, möchte es aber in der Bildergallery verwenden.

Thanks Andy

Offline Sebas Bonito

  • Sr. Member
  • ****
  • Posts: 271
  • Sebas Bonito
    • View Profile
Re: [Mod] Auto image resize on upload.
« Reply #453 on: July 02, 2010, 04:14:04 PM »
Quote from: stb
2) default display resized image, but make smthn. like button "hi res" to view an original

On my site I use [Mod] Show original image in new window by clicking on image.
And this mod automaticaly copy original file to /big/ folder if the image is being resized (/big/ folder also automaticaly created if its not exist).
Just need use in Step 1. this code:
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;
                  }
                       }
                     }
                  }
//-------------------------------------------

P.S. it works on my windows system, dont know about any others :roll:

I still do need help to resize also the big/original-file. In my gallery some pictures are 7 Megabyte (!), too much :-) So I've resized all my big-images by an php-image-resizer to a max-height or max-width of 1600px and a jpg-quality of 75. This took many hours!

I'd like to have this function in 4images for the original-image, before it will be copied in to the big-folder.

So please, I do hope, somecone could help me out...

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #454 on: October 02, 2010, 10:23:54 AM »
Does anyone know if EXIF info will be lost if image will be auto resized? I tested this on my site and EXIF is gone. Anyone know how to fix that?

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #455 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 #456 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 :)
  • Administrator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: [Mod] Auto image resize on upload. (updated 19/09/04)
« Reply #457 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 :)
  • Administrator
  • 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 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 #459 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 #460 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 :)
  • Administrator
  • 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 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 #462 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 :)
  • Administrator
  • 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 #463 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 #464 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 »

 

Post your comments here