There are a few minor ’bugs’ in MaxiGallery, and being the froody guy I am (read the HitchhikersGuide) I fixed them and am kind enough to post the fixes here.
To make it a learning experience, you will have to change the stuff yourself. *nienernienerniener*
Not middle-aligned gallery images.
Solution: Simple, search for "align=" in the snippet code and soon you will find
align=\"center\"
I totally disagreed with that method, so I of course changed both instances of this to
class=\"GalleryItem\" and used a nice CSS value for it all.
Problem solved!
Preview pictures too big and too small / Not being able to set thumbnail x/y or view x/y.
Okay, this is slightly more difficult: You have to go into functions.php in the snippet dir (assets/snippets/maxigallery) and edit it after you make a backup of course!
There is a function:
if($resize){
$thumb->size_auto($max_thumb_size);
}
Just change that to:
if($resize){
$sizes = split('x', $max_thumb_size);
if (count($sizes) > 1) {
$thumb->size($sizes[0], $sizes[1]);
} else {
$thumb->size_auto($sizes[0]);
}
}
It is backwards compatible but now it supports max-X and max-Y values. Look at the two examples, giving an identical result.
&max_thumb_size=`100` (old style)
&max_thumb_size=`100x100` (new style, but old style still supported)
But, if you want thumbnails of a non-square size, you can do it now!
&max_thumb_size=`120x100` (new style, slightly wider thumbnails, but not higher
This also works for &max_pic_size=`600`
Problem solved!
I can’t upload images! I get the error Warning: move_uploaded_file(): SAFE MODE Restriction in effect.
This is also in the snippet code itself. Look for the code:
if(!file_exists($path_to_gal)) {
mkdir($path_to_gal);
chmod($path_to_gal,0777);
}
And before you change it, copy/paste this in a notepad and edit the code accordingly. Basically you have to create the dir via FTP in the snippet, thats’ why it needs your FTP details. Also, this is ONLY needed with the exact error given above.(SAFE MODE Restriction in effect.) In most situations the original code will work fine, but this is for those with ’safe’ webhosts.
if(!file_exists($path_to_gal)) {
if(ini_get('safe_mode') == 'Off')
{
$old_umask = umask(0);
mkdir($path_to_gal, 0777) or die('could not create directory');
umask($old_umask);
}
else
{
$connect = ftp_connect('ftpserver') or die('<p>Connection to FTP failed.</p>');
$login = ftp_login($connect, 'ftpUser', 'ftpPass') or die('<p>Could not login to FTP.</p>');
$changeDir = ftp_chdir($connect, '/assets/galleries/') or die('<p>Could not change directory.</p>');
$makeDir = ftp_mkdir($connect, $pageinfo['id']) or die('<p>Could not created directory.</p>');
$old_umask = umask(0);
$setPerm = ftp_site($connect, "CHMOD 0777 /assets/galleries/".$pageinfo['id']."/") or die('<p>Could not set permissions.</p>');
umask($old_umask);
ftp_close($connect);
}
}
That’s about it. I thought I should share this with the MODx community especially since it’s a very nice CMS.