CMS MADE SIMPLE FORGE

Album

 

[#3587] Autothumbnail size possible fix

avatar
Created By: Ben (BenH)
Date Submitted: Tue Jun 23 06:25:53 -0400 2009

Assigned To:
Version: None
CMSMS Version: None
Severity: Minor
Resolution: None
State: Open
Summary:
Autothumbnail size possible fix
Detailed Description:
Great work on the Album module for CMSMS, I'm a real fan and will be using this
a lot.

I've noted the issue in the help file with the autothumbnailsize, and thought
I'd share a hack I've done to make this more 'friendly'.

In class.Album.php, I altered the following lines
    // Make tall thumnails fit in box
 if ($picture->thumbnailheight > 72)
 {
        $picture->autothumbnailsize = ' height="72"';
 }
    else
    {
$picture->autothumbnailsize = ' height="'.$picture->thumbnailheight.'"';
 }


To:

  if ($picture->thumbnailheight * 4/3 < $picture->thumbnailwidth)
  {
    if ($picture->thumbnailwidth > $this->Lang('maxthumbnailwidth'))
    {
      // Make wide thumbnails fit in box
$picture->autothumbnailsize = '
width="'.$this->Lang('maxthumbnailwidth').'"';
    }
    else
    {
       $picture->autothumbnailsize = ' width="'.$picture->thumbnailwidth.'"';
    }
  }
  else
  {
    if ($picture->thumbnailheight > $this->Lang('maxthumbnailheight'))
    {
    // Make tall thumnails fit in box
$picture->autothumbnailsize = '
height="'.$this->Lang('maxthumbnailheight').'"';
    }
    else
    {
$picture->autothumbnailsize = ' height="'.$picture->thumbnailheight.'"';
    }
  }


In the language file en_US.php, I added the following lines:
$lang['maxthumbnailheight'] = 72;
$lang['maxthumbnailwidth'] = 96;

The coding's not very pretty, and I'm not sure whether putting configuration
options into the LANG file is the right thing to do, but it works for me.

Cheers,
BenH


History

Comments
avatar
Date: 2011-11-17 05:04
Posted By: Bruno TIGNAC (keleier)

I've solved this problem in another way :

file Album/classes/module/class.Album.php

- line 454 : 
$picture->thumbnailheight = '';
changed to 
$picture->thumbnailheight = 0;

- line 462 :
 if ($picture->thumbnailheight > 72)
changed to
if ($picture->thumbnailheight > 72 || ($picture->thumbnailheight <= 0 &&
$picture->thumbnailwidth <> 96))

Kenavo

Bruno (Keleier)
      
avatar
Date: 2011-11-17 05:24
Posted By: Bruno TIGNAC (keleier)

To complete my post :

+ oups, read, $picture->thumbnailwidth != 96 instead of $picture->thumbnailwidth
<> 96

+ there's a CSS turnaround :

-PHP : file Album/classes/module/class.Album.php : 
comment the if statement startad at line 462

- CSS : file Album/css/stylesheet.css
add :
.thumb a img
{
	max-width:96px; 
	max-height:72px;
}

Kenavo

Bruno (Keleier)