Extension talk:SmoothGallery/LQT Archive 1

Examples
Any examples of this in use, please? 128.250.80.15 01:42, 10 January 2007 (UTC)


 * Sorry, I don't have a publicly accessible website available (yet). The best I can say right now is to visit the SmoothGallery site and look at examples of SmoothGallery in action. --Ryan lane 21:30, 11 January 2007 (UTC)


 * I have one now, it is at my sandbox (currently view only). --Ryan lane 06:56, 3 March 2007 (UTC)

PHP Bug
Hey I keep getting the: Call to a member function getThumbnail on a non-object From this line (and probably more along the way): $full_thumb_obj = $img_obj->getThumbnail( $width, $height ); I been googling a lot and it seems to be a new 'feature' in the newer versions of php5.+ Concerning passing non-objects to functionszzzz. blablabla. Im using PHP Version 5.0.5-2 Zend Engine v2.0.5 Apache20 Has anyone found a solution for this?? Thx a lot! Rune.


 * I've tried it using PHP 4.3, and MediaWiki 1.6; and PHP 5.1, and MediaWiki 1.8. $img_obj is being created through an object factory function, and $img_obj->getThumbnail($width,$height) is being passed two strings. It is possible that Image::newFromName is returning a null value... How are you using the extension? Image:Image.png or Image.png ; Notice you need the latter of the two. --Ryan lane 19:28, 16 January 2007 (UTC)


 * Looks like this is exactly the issue. I wasn't checking to make sure the image object wasn't null when it was returned, which of course is a bug because Image::newFromName can return null values... Try the new version. --Ryan lane 19:59, 16 January 2007 (UTC)
 * YES! Tried the new version and it returned an error about not being able to find the files. great! So I found out that its because im uploading the images via sshfs and using the $wgUseSharedUploads = true; setting in LocalSettings.php. When I upload files via the upload feature in the wiki it works great. Only thing is that I had to change line 97 to $name = "myGallery" . mt_rand;. Because gmp_strval( gmp_random(1) gave me an error. Will try to make it support the $wgUseSharedUploads = true; and let you know if I succeed. Thankyou so much for your help!!!!! Rune.

Remark to "Installation"
A phantastic extension, A++++. One little remark. I installed the extension on the 1.9.1 version, running on an Fedora Core 6 Linux in a separate directory outside the document root with a symlink. In LocalSettings.php, I had to change the specific configuration as follows to make the extension work. Change the filename of SmoothGallery to whatever your name is.

require_once("extensions/SmoothGallery.php"); $wgSmoothGalleryExtensionPath = "$wgScriptPath/extensions/SmoothGallery"; $wgSmoothGalleryDelimiter = "\n"

The extension worked immediately - only trap is that you have to use the upload function within the Wiki to get the images displayed.

dutchfrog 2007-02-01

I'm a newbie, but to get this to work on 1.9.3, I had to add a semicolon to the end of the third line, otherwise I kept getting "Parse error: syntax error, unexpected T_VARIABLE" Now that I have this extension working, I'M SO HAPPY! This is such a kick-a** extension.

$wgSmoothGalleryDelimiter = "\n";

Looks very broken with JS disabled
Hm, nice - but if you view the page with JavaScript disabled, it looks completely broken. It would be nice if it would degrade gracefully. This could be achived by simply setting all images to display:none per default, for example. It would be ideal to provide a completely separate view, like mediawikis build-in galleries, which is hidden if JS is enabled - this should be simple, ImageGallery.php can be used to create it. -- Duesentrieb ⇌ 17:24, 3 March 2007 (UTC)


 * Agreed. There are a few things I need to work out before I even mark this as beta. If you can send me some patches, or help fix it in svn I wouldn't mind ;). --Ryan lane 14:17, 13 March 2007 (UTC)

Ok, I just was bold and added the fallback functionality in 20420 (diff). Have a look if you like. Some more things I came across:
 * mentioning your mail address in extension code will get it spamed.
 * watch out for HTML injection - for example, the with and height attributes could be used for XSS attacks, it seems.
 * split out the code for rendering and the special page into separate files, so only a minimal amount of code is loaded if SmoothGallery isn't used on a page.
 * the dummy parser seems pointless, it's never used. $dummy = NULL will do fine.
 * use separate localization files, only load messages when needed
 * only link JS/CSS files when SmoothGallery is being used on a page. This can be done by putting a flag into the parser output object, and looking for it in a OutputPageParserOutput hook.

Just some thoughts :) If you don't mind, I'll implement some when I feel the urge. Have a look at Extension:Player too, by the way. I have used some of the things i talked about there.

Regards, and thanks for the eye candy -- Duesentrieb ⇌ 00:18, 14 March 2007 (UTC)


 * Wow. I just tried the patched version in svn, and it works perfectly without javascript. Thanks a lot for the patches! Seeing how well you fixed the javascript degrading issue, I don't mind if you update the plugin whenever you'd like.


 * As for the tips, I'll look into these soon; if you hit a few before me, I don't mind. I'll probably up the version number, and change the download link whenever the full list is done. --Ryan lane 21:35, 14 March 2007 (UTC)


 * Well, what I did does have the disadvantage that yet another thumbnail is loaded for each image, even if its never shown :(
 * Anyway... I'll keep digging around (see below). sooner or later the code needs some restructuring though (rendering class, special page class, etc) -- Duesentrieb ⇌ 23:31, 14 March 2007 (UTC)


 * Yeah, that is true. Maybe it is possible to reuse the thumbnails from MediaWiki's image gallery for the smooth gallery's gallery? --24.252.67.18 02:08, 15 March 2007 (UTC)

category-to-gallery
I have added support for category-based galleries. To make a SmoothGallery from the images in category Foo, simply do this: Category:Foo

I'll probably also add a convenient mode for this to the special page: Special:SmoothGallery/Foo would show the images from category Foo. what do you think? -- Duesentrieb ⇌ 23:28, 14 March 2007 (UTC)


 * Sounds great! The special page was kind of limiting with just image names (as it is limited by url length). Categories would make it far more useful. --24.252.67.18 01:59, 15 March 2007 (UTC)