Author Topic: [MOD] Min. width/height/size for images/thumbs on upload  (Read 41540 times)

0 Members and 1 Guest 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] Min. width/height/size for images/thumbs on upload
« on: April 10, 2005, 12:12:30 AM »
This mod will add a minimum width/height and size requirements for new uploaded images.

----------- [ Changed files ] -------------

admin/settings.php
includes/upload.php
lang/<yourlangauge>/admin.php
lang/<yourlangauge>/main.php




----------- [ Installataion ] -------------

Step 1
Open admin/settings.php
Find:
Code: [Select]
 show_setting_row("max_thumb_width");
  show_setting_row("max_thumb_height");
  show_setting_row("max_thumb_size");
  show_setting_row("max_image_width");
  show_setting_row("max_image_height");
  show_setting_row("max_media_size");


Replace with:
Code: [Select]
 show_setting_row("max_thumb_width");
  show_setting_row("max_thumb_height");
  show_setting_row("max_thumb_size");
  show_setting_row("min_thumb_width");
  show_setting_row("min_thumb_height");
  show_setting_row("min_thumb_size");
  show_setting_row("max_image_width");
  show_setting_row("max_image_height");
  show_setting_row("max_media_size");
  show_setting_row("min_image_width");
  show_setting_row("min_image_height");
  show_setting_row("min_media_size");




Step 2
Open includes/upload.php
Find:
Code: [Select]
 var $max_size = array();

Insert below:
Code: [Select]
 var $min_width = array();
  var $min_height = array();
  var $min_size = array();



Step 2.1
Find:
Code: [Select]
   $this->max_size['media'] = $config['max_media_size'] * 1024;

Insert below:
Code: [Select]
   $this->min_width['thumb'] = $config['min_thumb_width'];
    $this->min_width['media'] = $config['min_image_width'];
    $this->min_height['thumb'] = $config['min_thumb_height'];
    $this->min_height['media'] = $config['min_image_height'];

    $this->min_size['thumb'] = $config['min_thumb_size'] * 1024;
    $this->min_size['media'] = $config['min_media_size'] * 1024;



Step 2.2
Find:
Code: [Select]
   $this->image_size = @getimagesize($this->upload_file);
    $ok = 1;


Insert below:
Code: [Select]
   if ($this->image_size[0] < $this->min_width[$this->image_type]) {
      $ok = 0;
      $this->set_error($this->lang['invalid_image_width_min']);
    }

    if ($this->image_size[1] < $this->min_height[$this->image_type]) {
      $ok = 0;
      $this->set_error($this->lang['invalid_image_height_min']);
    }



Step 2.3
Find:
Code: [Select]
 function save_file() {

Insert above:
Code: [Select]
 function check_min_filesize() {
    if ($this->HTTP_POST_FILES[$this->field_name]['size'] < $this->min_size[$this->image_type]) {
      return false;
    }
    else {
      return true;
    }
  }



Step 2.4
Find:
Code: [Select]
     if (eregi("image", $this->HTTP_POST_FILES[$this->field_name]['type'])) {

Insert above:
Code: [Select]
     if (!$this->check_min_filesize()) {
        $this->set_error($this->lang['invalid_file_size_min']);
        $ok = 0;
      }




Step 3
Open lang/<yourlangauge>/admin.php
Find:
Code: [Select]
$auto_thumbnail_resize_type_optionlist = array(

Insert above:
Code: [Select]
$setting['min_thumb_width'] = "Min. width of thumbnail in pixel";
$setting['min_thumb_height'] = "Min. heigth of thumbnail in pixel";
$setting['min_thumb_size'] = "Min. thumbnail size in KB";
$setting['min_image_width'] = "Min. image width in pixel";
$setting['min_image_height'] = "Min. image heigth in pixel";
$setting['min_media_size'] = "Min. image size in KB";




Step 4
Open lang/<yourlangauge>/main.php
At the end, above closing ?> insert this:
Code: [Select]
$lang['min_filesize'] = "Min. File Size: ";
$lang['min_imagewidth'] = "Min. Image Width: ";
$lang['min_imageheight'] = "Min. Image Height: ";
$lang['invalid_image_width_min'] = "Image width invalid";
$lang['invalid_image_height_min'] = "Image heigth invalid";
$lang['invalid_file_size_min'] = "Image size invalid";




Step 5
Download this database updater
Unpack it and upload to your 4images root diretory.
Execute it by typing in your browser http://<yoursiteaddress>/install_min_upload.php and follow the instructions.

After all this done, u should see new settings under "Upload settings" section in ACP->Settings.

P.S. your 4images administrator will not be affected by any of the upload restrictions! Test it as a regular member or as a guest.
« Last Edit: March 29, 2010, 03:03:14 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 TIMT

  • Hero Member
  • *****
  • Posts: 505
    • View Profile
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #1 on: June 02, 2005, 10:18:33 AM »
Hi V@no

Would it be a big deal to implement a check of the relation between the width and height?

I print photocards. The accepted relations are 3:2 and 4:3.
So I can print photocards with the following sizes:
11 x 16.5 cm (3:2)
12 x 16 cm (4:3)

Now I have to check all the pictures manual. This is very time-consuming.

Thank you for your Help.

Serge

Offline zoolmann

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • www.fotoseznam.cz
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #2 on: September 11, 2005, 10:24:07 PM »
Problem:

Fatal error: Call to undefined function: check_min_filesize() in /hosting/hw015931/public_html/includes/upload.php on line 187
Sorry for my bad English :-)
----------------------------------

- Today's visit rate

TheOracle

  • Guest
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #3 on: September 11, 2005, 11:08:23 PM »
Quote

Fatal error: Call to undefined function: check_min_filesize() in /hosting/hw015931/public_html/includes/upload.php on line 187


Are you sure to have implemented step 2.3 as well ?

Offline Melder

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #4 on: November 30, 2006, 10:46:42 AM »
Download des DB-Updaters funktioniert nicht mehr!?!?!

Help  :cry:

Offline Melder

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #5 on: December 01, 2006, 10:14:49 AM »
Hi,

hat noch jemand den Updater? Habe nämlich dummer Weise den Rest schon geändert...  :oops:

Offline Melder

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #6 on: December 03, 2006, 05:48:35 PM »
Juchhhuuuuuuuu, kann mich jemand hören??? Hat noch jemand den DB-Updater oder eine andere Idee die Minimalgröße der Uploadbilder zu bestimmen und kontrollieren zu lassen???

Vielleicht könnte auch jemand meine Problematik ins englische übersetzten um mehr Leute zu erreichen!!!

THX Achim

Offline mawenzi

  • Moderator
  • 4images Guru
  • *****
  • Posts: 4.500
    • View Profile
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #7 on: December 03, 2006, 07:26:59 PM »
Vielleicht könnte auch jemand meine Problematik ins englische übersetzten um mehr Leute zu erreichen!!!

... vermessen bist du nicht, dass du solche Statements hier ablässt ...  :?:
Your first three "must do" before you ask a question ! ( © by V@no )
- please read the Forum Rules ...
- please study the FAQ ...
- please try to Search for your answer ...

You are on search for top 4images MOD's ?
- then please search here ... Mawenzi's Top 100+ MOD List (unsorted sorted) ...

Offline Melder

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #8 on: December 04, 2006, 05:57:10 PM »
Was soll ich tun, wenn keiner reagiert???

Hast mir prima geholfen, vielen Dank  :(

Offline tansamalaja

  • Full Member
  • ***
  • Posts: 185
    • View Profile
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #9 on: December 31, 2006, 01:18:29 PM »
Is there any contact to vano possible? Is he still active in this community?

Else would it be better if his MODs would be taken out if important parts are missing.

Offline baseline

  • Newbie
  • *
  • Posts: 21
    • View Profile
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #10 on: January 06, 2007, 01:26:26 PM »
hallo,

hier ist der installer von vano.

gruss sascha

Offline Melder

  • Jr. Member
  • **
  • Posts: 89
    • View Profile
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #11 on: January 10, 2007, 06:18:40 PM »
Vielen vielen Dank, hast mir wirklich sehr geholfen ...  :D

Offline Smoothice

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • Casual Victims
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #12 on: June 13, 2007, 06:01:29 AM »
I was just about to install this mod but there is no database updater with this.  If anyone has it can they please upload it.

Smoothice

Offline KurtW

  • 4images Guru
  • *******
  • Posts: 2.778
    • View Profile
    • Malediven-Bilder ~~Dreams~~
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #13 on: June 13, 2007, 06:04:45 AM »
Hi, Smoothice

and what is the attachement 2 post up (post by baseline).   8O

cu
Kurt

Offline Smoothice

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • Casual Victims
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #14 on: June 13, 2007, 06:07:02 AM »
I tried dling it and it doesn't do anything.  Try clicking on it and tell me if it works?

Smoothice