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

0 Members and 1 Guest are viewing this topic.

Offline Smoothice

  • Newbie
  • *
  • Posts: 33
    • View Profile
    • Casual Victims
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #15 on: June 13, 2007, 06:09:04 AM »
Sorry I just loaded the site up with IE and tried it and it worked.  Sorry for your trouble

Smoothice

Offline Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #16 on: March 29, 2010, 01:32:16 PM »
@v@no: are you sure that step Step 2.2b   is correct?

Lets look at check_image_size with install mod Auto iamge resize and Min. width...:

Code: [Select]
  function check_image_size() {
    $this->image_size = @getimagesize($this->upload_file);
     if ($this->auto_image[$this->image_type]) {
      return 1; //auto image is on, don't need check for anything else.
    }
    $ok = 1;
    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']);
    }
    if ($this->auto_image[$this->image_type] == 1) {
       return $ok;
    }
    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;
  }

So if mod auto image resize is active it will return 1 even if image is smaller then minimun width in config.

Am I wrong?  :?

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] Min. width/height/size for images/thumbs on upload
« Reply #17 on: March 29, 2010, 02:25:16 PM »
Yes, it is correct.
With auto image resize mod we don't have any restrictions on image dimensions, the image will be resized to the max width/height anyway.
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 Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #18 on: March 29, 2010, 02:32:41 PM »
Do you have any temporary solution how to fix that problem?

Maybe I should check if image is smaller then minimum size, then don't skip auto resize, if not smaller then check auto resize?

Code: [Select]
    if ($this->auto_image[$this->image_type] && $this->image_size[0] > $this->max_width[$this->image_type] && $this->image_size[1] > $this->min_height[$this->image_type]) {
      return 1; //auto image is on, don't need check for anything else.
    }

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] Min. width/height/size for images/thumbs on upload
« Reply #19 on: March 29, 2010, 02:37:02 PM »
but there is no min width/height settings...
(wait, double checking)

Ok, I see it now.
Gee...I guess it's too early in the morning for me, this is completely different mod I was thinking it is...

The instructions in this mod are correct, but auto resize mod needs to be corrected to make it compatible.


I've modified instructions in both mods, they should be compatible with each other now.

Use this function instead:
  function check_image_size() {
    
$this->image_size = @getimagesize($this->upload_file);
    
$ok 1;
    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']); 
    } 
    if (
$this->auto_image[$this->image_type]) { 
       return 
$ok
    } 
    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: March 29, 2010, 03:05:58 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 Lucifix

  • Hero Member
  • *****
  • Posts: 710
    • View Profile
    • http://www.slo-foto.net
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #20 on: April 06, 2010, 10:24:09 PM »
Thank you its working ;)

Offline GaYan

  • Sr. Member
  • ****
  • Posts: 301
  • ♫ | G2 | ♫
    • View Profile
    • Ziramagic
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #21 on: April 07, 2010, 04:42:36 AM »
Great..now this is working  :)
I'm Back :)

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #22 on: July 25, 2012, 09:54:57 AM »
Hallo!
mein Problem:
in der Galerie soll es eine mindestgrösse geben - einmal beim Hochformat und einmal beim Breitformat, d.h.
beispiel:
mindestgrösse beim Breitformat höhe: 800px; Breite: keine
mindestgrösse beim Hochformat höhe: keine; Breite: 800px

es gibt ja schon die modifikation:
http://www.4homepages.de/forum/index.php?topic=7325.0

leider unterscheidet diese aber nicht Hoch/Breitformat. Kann man irgendwie eine Abfrage einbauen, ob es ein Hoch/Breitformatbild ist?
oder kann man vor dem upload eine Auswahl Hoch/Breitformat abfragen?

Rembrandt

  • Guest
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #23 on: July 26, 2012, 06:33:24 AM »
Hi!
...mindestgrösse beim Breitformat höhe: 800px; Breite: keine
...mindestgrösse beim Hochformat höhe: keine; Breite: 800px
...
Ich bekomme einen Gehirnkrampf in aller früh..  8O :mrgreen:

versuche einmal das, ersetze step.2.2) aus dem mod mit dem hier:

if ($this->image_size[0] > $this->image_size[1]){ //Querformat check ...mindestgrösse beim Breitformat höhe: 800px; Breite: keine
  
if ($this->image_size[1] < $this->min_height[$this->image_type]) {
    
$ok 0;
    
$this->set_error($this->lang['invalid_image_height_min']);
  }
}
if (
$this->image_size[1] > $this->image_size[0]){ //Hochformat check ...mindestgrösse beim Hochformat höhe: keine; Breite: 800px
  
if ($this->image_size[0] < $this->min_width[$this->image_type]) {
    
$ok 0;
    
$this->set_error($this->lang['invalid_image_width_min']);
  }
}


mfg Andi
« Last Edit: July 26, 2012, 12:07:23 PM by Rembrandt »

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #24 on: July 26, 2012, 10:50:19 AM »
danke erstmal..
leider ein fehler:
Parse error: syntax error, unexpected T_IF in /home/www/xxxxx/includes/upload.php on line 118
die zeile 118:

  
if ($this->image_size[1] < $this->min_height[$this->image_type]) {



ich habe zwei klammern eingefügt, dann ging es.
also so:
	
if (
$this->image_size[0] > $this->image_size[1]){ //Querformat check ...mindestgrösse beim Breitformat höhe: 800px; Breite: keine
  
if ($this->image_size[1] < $this->min_height[$this->image_type]) {
    
$ok 0;
    
$this->set_error($this->lang['invalid_image_height_min']);
  }
}
if (
$this->image_size[1] > $this->image_size[0]){ //Hochformat check ...mindestgrösse beim Hochformat höhe: keine; Breite: 800px
  
if ($this->image_size[0] < $this->min_width[$this->image_type]) {
    
$ok 0;
    
$this->set_error($this->lang['invalid_image_width_min']);
  }
}

aber leider klappt die Abfrage nicht so wie sie soll..
beim Querformat spuckt es die Höhenfehlermeldung raus
und beim Hochformat die Breitenfehlermeldung.
das sollte ja eigentlich anders herum sein...

Nachtrag:
ich Esel!!
es sollte natürlich alles anders herum sein!!!
der fehler liegt in meiner Erklärung.. heul..
also:
Querformat check ...mindestgrösse beim Breitformat höhe: keine; Breite:800px
und
Hochformat check ...mindestgrösse beim Hochformat höhe: 800px; Breite: keine
wie muss der code dann heisse?
« Last Edit: July 26, 2012, 11:36:34 AM by Loda »

Rembrandt

  • Guest
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #25 on: July 26, 2012, 12:23:21 PM »
Hi E...   :mrgreen:

ja klammern vergiss ich immer gerne  :)


if ($this->image_size[0] > $this->image_size[1]){ //Querformat check
  
if ($this->image_size[0] < $this->min_width[$this->image_type]) { //...mindestgrösse beim Breitformat höhe: keine; Breite:800px
    
$ok 0;
    
$this->set_error($this->lang['invalid_image_width_min']);
  }
}
if (
$this->image_size[1] > $this->image_size[0]){ //Hochformat check ...
  
if ($this->image_size[1] < $this->min_height[$this->image_type]) { //...mindestgrösse beim Hochformat höhe: 800px; Breite: keine
    
$ok 0;
    
$this->set_error($this->lang['invalid_image_height_min']);
  }
}


mfg Andi

« Last Edit: July 26, 2012, 03:32:05 PM by Rembrandt »

Offline Loda

  • Sr. Member
  • ****
  • Posts: 353
    • View Profile
    • Fotosucht Schweiz
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #26 on: July 26, 2012, 02:20:40 PM »
jepp.. das wars! vielen lieben Dank!

nur die fehlermeldung musste ich noch tauschen.

jetzt gehts!

Offline ante226

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #27 on: August 19, 2012, 06:35:42 PM »
step 2.4 finde ich nicht in der uploaded.php


Rembrandt

  • Guest
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #28 on: August 19, 2012, 06:54:07 PM »
Hi!
step 2.4 finde ich nicht in der uploaded.php

lies dir Bitte Punkt 9.) mal durch, Danke!

seit der 4i V1.7.8 lautet die Zeile:

if (preg_match("/image/i"$this->HTTP_POST_FILES[$this->field_name]['type'])) {


mfg Andi

Offline ante226

  • Newbie
  • *
  • Posts: 24
    • View Profile
Re: [MOD] Min. width/height/size for images/thumbs on upload
« Reply #29 on: August 19, 2012, 07:02:11 PM »
ich danke dir für die schnelle hilfe

eins habe ich aber noch finde die datei install_min_upload.php nicht ???

soll als anhang sein ist aber nicht mehr

wenn einer sie hat würde ich mich freuen die nochmal anzuhängen


m-f-g
ante