IE8 Web Slices with NextGEN Gallery

21Mar09

Web SlicesToday I updated to IE8 and played a bit with the new features. One new feature is the Microformat “Web Slices”. Not sure if I really need it, but for some test I’ve added the feature to the widgets, so you can create a Gallery Web Slice to inform about new images…

Here is the small fix, if you would like to test it. Look into the widget admin panel to activate it .

Wish everybody a nice weekend

18 Responses to “IE8 Web Slices with NextGEN Gallery”


  1. Gravatar Icon 1 Ramoonus Posted March 22nd, 2009 - 10:12

    Yaay more great functions for nextgen gallery! ;)

  2. Gravatar Icon 2 Gustav Posted March 22nd, 2009 - 21:16

    I’ve made a small modification to my nextgen plugin that might be of interest to make public. I’v added a function similar to singlepic but called randompic. It is what it sounds like. It takes a random image and displays it as a singlepic. There is also an option to choose which gallery the image should be chosen from.

    syntax:
    [randompic gallery=x w=width h=height mode=web20|watermark float=left|right] optional text [/randompic]
    or
    [randompic gallery=x w=width h=height mode=web20|watermark float=left|right]

    All options are optional.

    The code is only added in /lib/shortcodes.php (it is a ripoff from [singlepic]):

    add_shortcode( ‘randompic’, array(&$this, ‘show_randompic’ ) );

    ..

    if ( stristr( $content, ‘[randompic' )) {
    $search = "@\[randompic=(\d+)(|,\d+|,)(|,\d+|,)(|,watermark|,web20|,)(|,right|,center|,left|,)\]@i”;
    if (preg_match_all($search, $content, $matches, PREG_SET_ORDER)) {

    foreach ($matches as $match) {
    // remove the comma
    $match[2] = ltrim($match[2], ‘,’);
    $match[3] = ltrim($match[3], ‘,’);
    $match[4] = ltrim($match[4], ‘,’);
    $match[5] = ltrim($match[5], ‘,’);
    $replace = “[randompic gallery=\"{$match[1]}\” w=\”{$match[2]}\” h=\”{$match[3]}\” mode=\”{$match[4]}\” float=\”{$match[5]}\” ]”;
    $content = str_replace ($match[0], $replace, $content);
    }
    }
    }

    ..

    function show_randompic( $atts, $content = ” ) {

    extract(shortcode_atts(array(
    ‘gallery’ => 0, //if no gallery is specified, an image from all galleries is chosen
    ‘w’ => ”,
    ‘h’ => ”,
    ‘mode’ => ”,
    ‘float’ => ”,
    ‘template’ => ”
    ), $atts ));

    $picturelist = nggdb::get_random_images(1,$gallery); //get one random image from $gallery
    $id = $picturelist[0]->pid; //get the id from that one image, wich is the first (and only…)

    $out = nggSinglePicture($id, $w, $h, $mode, $float, $template, $content);

    return $out;
    }

    All parts of code is inserted next to the same code for singlepic.

    I hope this can be of use to others as well. An example can be found at my website: http://averater.se/photo

    enjoy /Gustav

  3. Gravatar Icon 3 Yogie Posted March 23rd, 2009 - 09:34

    I would prefer smaller updates on existing features, as adding more EXIF tags according to the EXIF standard 2.2 (http://www.exif.org/specifications.html) such as adding support for “Flash, Flash Energy, Light Source, Exposure Program, Scene Type, Metering Mode etc….” I would do by my own if I would know how to :)

  4. Gravatar Icon 4 Gustav Posted March 23rd, 2009 - 18:31

    I do realize that my last comment is most likely wrongly placed but I didn’t know where to put it (and I still dont…).

    But however: I do have a better (maybe) way of creating essentially the same thing but without adding another of those tags. By just changing the singlepic by checking if strtolower($id) == ‘random’, then if you write id=random (or Random or raNdom…) a random image is chosen. There is also a need for the (optional) extra input of what gallery to select the image from.

    If no backwards compatibility is needed then it is only needed to replace th following part of /lib/shortcodes.php:
    function show_singlepic( $atts, $content = ” ) {

    extract(shortcode_atts(array(
    ‘id’ => 0,
    ‘w’ => ”,
    ‘h’ => ”,
    ‘mode’ => ”,
    ‘float’ => ”,
    ‘template’ => ”
    ), $atts ));

    $out = nggSinglePicture($id, $w, $h, $mode, $float, $template, $content);

    return $out;
    }

    with:
    function show_singlepic( $atts, $content = ” ) {

    extract(shortcode_atts(array(
    ‘id’ => 0,
    ‘w’ => ”,
    ‘h’ => ”,
    ‘mode’ => ”,
    ‘float’ => ”,
    ‘template’ => ”
    ‘gallery’ => 0, //if no gallery is specified, an image from all galleries is chosen. WARNING this is ignored if id!=random
    ), $atts ));

    if (strtolower($id) == ‘random’) {
    $picturelist = nggdb::get_random_images(1,$gallery); //get one random image from $gallery
    $id = $picturelist[0]->pid; //get the id from that one image, wich is the first (and only…)
    }

    $out = nggSinglePicture($id, $w, $h, $mode, $float, $template, $content);

    return $out;
    }

    If backwards compatibility is needed then the “if ( stristr( $content, ‘[singlepic’ )) {” part of the function convert_shortcode needs to be altered too.

    regards Gustav

  5. Gravatar Icon 5 Thomas Posted March 24th, 2009 - 00:23

    You have a great widget there Alex. Thanks for all the hard work you’ve done. My only desire would be a pause/stop button for the slideshow, since my viewers may also be watching my videos.

  6. Gravatar Icon 6 alex.rabe Posted March 26th, 2009 - 21:29

    @Gustav

    please report changes here :

    http://code.google.com/p/nextgen-gallery/

  7. Gravatar Icon 7 Mark Posted March 29th, 2009 - 22:09

    How would the code for [nggallery id=1] look if I just open the php page and want it to go in a specific place.

  8. Gravatar Icon 8 Eathan Posted April 9th, 2009 - 23:41

    I’ve tried to upload pictures into nextgen gallery.. i keep getting a error 404. Has anyone had this problem before?

  9. Gravatar Icon 9 harpaz Posted April 11th, 2009 - 01:33

    hey,

    i down understand why my widget slideshow not vorking? :/ I add it but nothin is showin.. what I need to change?

  10. Gravatar Icon 10 harpaz Posted April 11th, 2009 - 10:44

    hey,

    NextGEN Slideshow not working to me and I dont understand why, no picture and nothing is showing then I add it:/ what can be wrong?? thanks fot replay.

  11. Gravatar Icon 11 Carlos Posted April 11th, 2009 - 19:23

    Great function. I like this widget.

  12. Gravatar Icon 12 Mike Posted May 11th, 2009 - 18:26

    I’m having problems with slideshows, they won’t appear in posts, or in the sidebar widget, just a blank space there. I thought it might be browser issues with FF, but it’s exactly the same in IE as well. I’ve been trying to search for a solution for about a week now, can’t find anything that helps so far.

  13. Gravatar Icon 13 Bryan Posted September 13th, 2009 - 01:32

    I’m getting a big blank as well. I can display single pictures, and the browser but as soon as I try to do a slideshow I get just a large white space where the slideshow should be. Anybody figure this one out? The short command is (without the spaces before or after the brackets) [ slideshow id=1 w=640 h=480 ]. I’ve also tried leaving out the width and height.

    IE 8.0.6, NextGEN 1.3.5, imagerotator.swf… don’t know version but it was downloaded today from the site. If I go to the flash.com site I do see the video so that is probably working.

    thanks for any help

    -Bryan

  14. Gravatar Icon 14 Bryan Posted September 14th, 2009 - 04:25

    Nevermind, I got it working by re-loading the imagerotator, and some combination of activating/deactivating the plugin.

  15. Gravatar Icon 15 Seej Posted November 11th, 2009 - 00:36

    Great function, thanks for sharing. I’m using it on a website, but the “random” function only works intermittently. Sometimes its fine, and reloading the page grabs a new image; other times I can’t get a different image no matter how often I reload. My gallery I’m pulling from has over 30 images, so the odds of it, “just magically pulling from one” is pretty slim. You can see this on the home page of http://www.davidlindner.com

    Thanks for any help.
    Best,
    Seej

  16. Gravatar Icon 16 Seej Posted November 12th, 2009 - 18:57

    [bump]

    One thing that I notice with this function: it works great if you’re not using a custom template. When I put in a custom template, the randomness becomes very irregular; generally a reload gets you the same image. I’m not doing anything fancy in my custom template, just making the image not a link. So not sure why this would fail. Any help, you know…greatly appreciated.

    Seej

  17. Gravatar Icon 17 W4yne Posted October 27th, 2011 - 11:48

    Hey, first thing, i love your plugin, that is how wordpress should do it :=). It is really great.
    But with the IE8, the thumbnails are really crashed, so I want to ask if there will be a fix on it?
    Thank you very much

  18. Gravatar Icon 18 Chris Posted December 22nd, 2011 - 10:05

    Hey Eathan;
    Please see this link:
    http://www.fzblog.net/detail/505

Comments are currently closed.