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)


 * Very cool! Here is a small example: http://www.gtr-tech.com/Main_Page I will be using it in a few other places soon.

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)


 * Hm, I tried and failed. When i set thumbHeight to 120 (or anything > 75), the carousel starts jumping (at least in FF). -- Duesentrieb ⇌ 22:12, 15 March 2007 (UTC)


 * Looks like a SmoothGallery bug. I'll look into it. I remember reading about a similar one when too many images were added to the gallery. --Ryan lane 03:06, 16 March 2007 (UTC)


 * Its an issue with the css. I fixed this by changing some of the carousel height pixel values:
 * In .jdGallery div.carouselContainer change height to 160px
 * In .jdGallery .carousel change height to 140px
 * In .jdGallery .carousel .carouselWrapper change height to 123px
 * I'm using the newest version of SmoothGallery. It seems this makes IE act erratically. I fixed IE by changing:
 * "this.carouselInner.style.width = ((this.maxIter * (this.options.thumbWidth + this.options.thumbSpacing)) - this.options.thumbSpacing + this.options.thumbWidth) + "px";
 * to
 * this.carouselInner.style.width = ((this.maxIter * (this.options.thumbWidth + this.options.thumbSpacing + 8)) + this.options.thumbSpacing) + "px";
 * The javascript fix was mentioned in the SmoothGallery forums.
 * --Ryan lane 17:48, 16 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)

I did some cleanup and tweaking today... have a peek at 20503 if you like. -- Duesentrieb ⇌ 22:13, 15 March 2007 (UTC)


 * Heh. Looks like you broke it a little. When you took out the "$previousoption" stuff, you caused the javascript to fail to parse (some options may or may not be used, and the list is comma delimited). I've added that back in for now. --Ryan lane 03:25, 16 March 2007 (UTC)


 * Uh, really? The code works fine for me, and since I added the thumbWidth and thumbHeight options, there's *always* a previous option, and the $previousoption flag is not needed. In fact, if it is used, it'll break the JS code, because no comma is emitted for the first item, even though it's preceeded by thumbHeight: 75. What problem did you have with my version of the code? -- Duesentrieb ⇌ 12:42, 16 March 2007 (UTC)


 * I tried Image:Test.png and the javascript failed to parse; however, I found the real culprit. $output .= 'timed: true,';</tt> needed to be: $output .= ', timed: true,';</tt>


 * When I get home later I'll revert the changes I made, and add that fix. --128.160.138.129 14:20, 16 March 2007 (UTC)

I can't get this function to work for the life of me. I can get all the other functionality of SmoothMedia, but not the Category Gallery. Is it still in the current build? -Rich 2 May 2007


 * Well, this hasn't been really released yet. If you use the beta version from SVN, this will work. The version from SVN most likely requires a much higher version of MediaWiki though (possibly even 1.10). The SVN version currently has one bug as well (which may not be a bug in MediaWiki 1.10), the title of the special page doesn't display. Other than that minor bug, it should work fine. --Ryan lane 13:39, 2 May 2007 (UTC)

Title / Description
Ryan,
 * Could you find a way to implement the title and description functions, into this extension. I don't think everyone wants to be reading the filename as the title. I'm on a robotics team, and this actually helps cut down on space, but I know some visitors would have no clue what is going on in some of the pictures we take. They are saying to themselves something along the lines of "Oh robots...what does that one over there do? or this one?" or "What is that person trying to do with the robot?". People like our Non-Engineering Mentors.

Thanks, Qsheets 01:16, 2 May 2007 (UTC)


 * The description currently pulls the text from the image page's text, so if you edit the image page, you can add a description. I'm contemplating matching the syntax of regular galleries, and letting users put descriptions right into the gallery. As for title, I'll try to figure out a way to do it. Currently, it uses the image name (the title of the image page). I'd recommend naming your images descriptively for now. --Ryan lane 13:41, 2 May 2007 (UTC)

Two errors
Hi, I am trying to implement the smooth gallery. However It is only partially working on my localhost, and is not working at all on the private site.

The first issue (using the latest code from Subversion) is that the line 302 $plain_gallery->add( $img_obj->getTitle ); //TODO: use text throws an error Fatal error: Call to undefined method Title::getName in C:\xampp\htdocs\cw\includes\ImageGallery.php on line 94

The second error is that It does not render as a smooth gallery at all, just A large image, and a thumbnail, all the way down the page

I have tried both formats i.e Image:animage.jpg Image:animage2.jpg

and animage.jpg animage2.jpg

I am using mediawiki 1.10. I have the following files in my Extension Directory folder smoothgallery_1.0.1 which i obtained from the site and unzipped. I then renamed it to smoothgallery I then have the following files SmoothGallery.php SpecialSmoothGallery.php SmoothGalleryClass.php SmoothGallery.i18n.php jd.gallery.js.patch jd.gallery.css.patch in the extension directory.

My local settings for this are include("extensions/SmoothGallery.php"); $wgSmoothGalleryExtensionPath = "$wgScriptPath/extensions/smoothgallery"; $wgSmoothGalleryDelimiter = "\n"

any suggestions would be greatly appreciated, thanks 85.210.41.52 00:07, 4 June 2007 (UTC)