Author Topic: [*droplet*] microGallery (place Gallery anywhere)  (Read 42501 times)

Offline noname8

  • Posts: 148
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #50 on: November 10, 2010, 10:43:24 PM »
Thanks for response,

I will test it later and probably adapt parts of your code.

Should be &sort=  not &order=
Yes, it's obvious, thank you.

Kind regards,
Stefek



I'd be happy to know why the original sort didn't work. But it might be my server also..

The code isn't my, that's why there is author comment & source at the bottom. Just copied it from php.net

Offline noname8

  • Posts: 148
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #51 on: November 17, 2010, 07:45:02 PM »
Small fix for copying the path with extra space (can cause a lot of problems tough)

add to line ~29 before the   $img_dir = WB_PATH.MEDIA_DIREC TORY.'/'.$folder.'/';
Code: [Select]
$folder=trim($folder);

Let's say I've chosed ONE way to use this gallery multiple times.

How can average person add new gallery without writing code ???
My idea is to add javascript input popup into MEDIA folder browsin window.
Like "Create gallery, click here" and it would give js popup to copy the code to clipboard.
Code: [Select]
prompt("Copy this to clipboard and paste to a page editor", "[[microGallery?folder=gallery34&group=lightbox&sort=DESC]]");
But how to get a current browsed folder path without media to th js ?

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #52 on: November 17, 2010, 08:47:15 PM »
Hello,

the microGallery Droplet won't replace a regular page module.
You should give a chance the "folder gallery" Module, which may fit your needs more.
This module generates for example thumbnails from all images.

microGallery Droplet is meant as an alternative way to inject a small Gallery to places where a standards Gallery Module doesn't make sense or is impossible to place without to much effort.

Kind regards,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline noname8

  • Posts: 148
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #53 on: November 17, 2010, 11:09:56 PM »
All these galleries are way too difficult to use for regular person.
Using microgallery and autoresize pictures when uploading it can be used very nicely even with set of 10 or 20 pictures without long loading times. So your droplet just seems to be the best!

I somehow managed to get the edit into wb admin to make this code popup into media browser:

template\wb_theme\templates\media_browse.htt:
(find and replace row ~47  : {TEXT_CURRENT_FOLDER}: {MEDIA_DIRECTORY}{CURRENT_DIR}
Code: [Select]
{MICROGALLERYADD} {TEXT_CURRENT_FOLDER}: {MEDIA_DIRECTORY}{CURRENT_DIR}

admin\media\browse.php:
line ~121, before // Insert values
Code: [Select]
if(strlen($directory)<1)$microgallerydirectory='';
else $microgallerydirectory='<a href="#" onclick="prompt(\'Copy this to clipboard and paste to a page editor\', \'[[microGallery?folder='.ltrim($directory, "/").'&group=lightbox&sort=DESC]]\');return false";> Get gallery code</a> ::';

also couple rows later the set_var array end should look like this:

Code: [Select]
'INCLUDE_PATH' => WB_URL.'/include',
'MICROGALLERYADD' => $microgallerydirectory




[gelöscht durch Administrator]

Offline noname8

  • Posts: 148
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #54 on: January 21, 2011, 11:36:30 AM »
So this awsome droplet has couple of things to be fixed !

- if you have digital camera & windows XP the images are always   .JPG   not .jpg   (uppercase)
--> Not visible in gallery !

so:
 
Code: [Select]
if (!preg_match('/.+\.(jpeg|jpg|gif|png)$/', $image_file) ||
-->
// HELP! CANNOT ADD /i without giving error ?!!?


$img_title = str_replace(array(".png", ".jpg", ".gif", ".jpeg"), "", $image_file);
-->
$img_title = str_ireplace(array(".png", ".jpg", ".gif", ".jpeg"), "", $image_file); //ireplace



Offline DJKat

  • Posts: 125
  • Gender: Male
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #55 on: January 28, 2011, 09:27:51 AM »
Hi folks!

First thanks a lot again for this great droplet!  :-D


I have fixed the JPG-issue for me this way:
Replaced line 26 with this
Code: [Select]
if (!preg_match('/.+\.(jpeg|jpg|gif|png|JPG|JPEG)$/', $image_file) || Just added JPG and JPEG. ;)


But I still have got another problem with microgallery...
When I add &sort=ASC to the call which would result in [[microGallery?folder=microgallery&group=fotos&sort=ASC]] shows the same order as if I had left the sort-command.

Any idea why this doesnt work?

Regards,
Dany


---------- EDIT ----------

Added aksort to my droplet and it works fine.
Maybe this sorting could be added in the original droplet as well...?

Regards,
Dany
« Last Edit: February 01, 2011, 08:35:32 AM by DJKat »

Offline dbs

  • Betatester
  • **
  • Posts: 8146
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #56 on: March 28, 2011, 05:13:08 PM »
Quote
Added aksort to my droplet and it works fine.
what does it mean?

i have killed the a from asort and it works (line 57).
but this can't be the right way.

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #57 on: March 28, 2011, 07:05:37 PM »
Hello guys,

look at the code:

Code: [Select]
<?php // ---> snippet

// check sorting
if((isset($sort) && $display == &#39;table&#39;) || (isset($sort) && $display == &#39;all&#39;)){
if($sort==&#39;ASC&#39;) asort($image_show);
if($sort==&#39;DESC&#39;) rsort($image_show);
if($sort==&#39;RANDOM&#39;) shuffle($image_show);
}

Sort will work only if 'all' (or 'table') is set to the display parameter.
No other combinations will be supportet.



Regards,
Stefek
« Last Edit: March 28, 2011, 07:07:17 PM by Stefek »
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline dbs

  • Betatester
  • **
  • Posts: 8146
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #58 on: March 28, 2011, 07:33:01 PM »
it want not work.

my call:
[[microGallery?folder=testordner&group=mad&display=table&sort=ASC]]  (or DESC)

there are 2 pics: green.jpg & blue.jpg
they never change the position.  :-D

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #59 on: March 28, 2011, 07:36:45 PM »
So you've got a problem now. :-D

Bon chance.

Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline dbs

  • Betatester
  • **
  • Posts: 8146
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #60 on: March 28, 2011, 08:29:45 PM »
here is a idea for one new display=:
the droplet show 1 pic from a folder. the lightbox will show all pics from this folder.
droplet-call: [[microGallery?folder=something&display=one]]

the code could be:
Code: [Select]
<?php
case &#39;one&#39;:  //&display=one
$output_value =  $image_show[0];
array_shift($image_array); //skip first Element of Array
$output_value .= &#39;<ul style="display:none">&#39;;
foreach ($image_array as $image){     
    $output_value .= &#39;<li>&#39;.$image.&#39;</li>&#39;;
}
$output_value .= &#39;</ul>&#39;;
break;

the code is a mix from cases "first" and "notfirst".
add the code in the droplet befor:  endswitch;

would be great if the rel in this case is cslide instead 'lightbox[".$group."]

edit: for import a test-droplet attached.
droplet-call must be:  [[microGallery-one?folder=somewhere&display=one]]

[gelöscht durch Administrator]
« Last Edit: March 28, 2011, 09:21:39 PM by dbs »

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #61 on: March 28, 2011, 08:40:11 PM »
Hello Frank,

nice one.

I am not working any further on this droplet.
If you want, you can work on a solution where there is another "Setting" for the 'rel'.

Maybe you have the time to go deeper into the Sort problem too.

Kind regards,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline dbs

  • Betatester
  • **
  • Posts: 8146
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #62 on: March 28, 2011, 08:44:44 PM »
hi stefek, i hope we have more as only me.  :-D

maybe other users have ideas/solutions too.

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #63 on: March 28, 2011, 09:10:20 PM »
Yes, of course.
Feel free to fork the code.
That's why its open source.

Regards,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline dbs

  • Betatester
  • **
  • Posts: 8146
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #64 on: March 28, 2011, 09:19:07 PM »
no, i don't want make a fork, only a test-droplet.

the extra-code should be in the original-droplet, if the code is working good.
for some users it is easier import as change code.
« Last Edit: March 28, 2011, 09:23:31 PM by dbs »

Offline Stefek

  • Posts: 6177
  • Gender: Male
  • ("ړ)
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #65 on: March 28, 2011, 09:33:26 PM »
Anyway you will need to fork it first, won't you?

Forking is a good thing. Look at gitHub.
All functioning teams (dev groups) work with forks in one way or another.

Regards,
Stefek
"Gemeinsam schafft man mehr."

gemeinsam
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Offline baggi80

  • Posts: 20
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #66 on: August 17, 2011, 01:25:18 PM »
Hi,

nice droplet  :-)

I know there ist no developing on this droplet but I have a Problem with the upcoming Gallery when I click a picture and I hope someone can help me.

Example with two Pictures in the folder. When I push the forward button, the galery close. When I open the second Picture and push the backward button it works... pushing the forward button again it close.


Someone idea?
« Last Edit: August 17, 2011, 01:52:58 PM by baggi80 »

Offline dbs

  • Betatester
  • **
  • Posts: 8146
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #67 on: August 17, 2011, 01:37:08 PM »
u can try to comment out this in module colorbox frontend.js:
Code: [Select]
var $gallery, previous, next;

        next = $.fn.colorbox.next;

        $.fn.colorbox.next = function(){
                if($gallery.index(previous) == ($gallery.length - 1)){
                        $.fn.colorbox.close();
                } else {
                        next();
                }
        };


                $gallery = $("a[rel='cslide']");

                $gallery.colorbox({onComplete: function(){
                        previous = this;
                }, onOpen: function(){
                        previous = this;
                }});

this should close slideshow at the end, but sometimes it makes more ... *g*

Offline baggi80

  • Posts: 20
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #68 on: August 17, 2011, 01:52:27 PM »
Okay thx now it works as expected

mic

  • Guest
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #69 on: August 20, 2011, 11:48:56 AM »
You may use this Droplet to place a (small)Gallery where ever you like (NEWS Posts etc.).
This droplet, of course, doesn't replace a general image-gallery-module, but it comes in handy if you need to display some pictures from a media-directory without to much effort.

Hi Stefek,

I can't get it to work. When I paste the code into the droplet-editor, the drop gets red immediately and WB complains about invalid code. I can't figure out what is going wrong.

Any help appreciated.

#m

Offline dbs

  • Betatester
  • **
  • Posts: 8146
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #70 on: August 20, 2011, 12:02:45 PM »
hi, the droplet-code is ok.
please paste your code here, i'll check it.

mic

  • Guest
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #71 on: August 20, 2011, 12:17:51 PM »
hi, the droplet-code is ok.
please paste your code here, i'll check it.

Great! ;)

It is the exact code from page #1 of this thread though.

I just added a couple of droplets, but none complained, so I think it is not a problem of Droplet (V1.51)

Code: [Select]
<?php
/*
"microGallery - place Gallery anywhere"
----------------------------------------
@Author: Christian M. Stefan (Stefek) <stefek@designthings.de>
*/

global $MESSAGE;
$output_value ="";
//  check if the &#39;folder&#39; Parameter is set in the Droplet
if (!isset($folder)):
$output_value $MESSAGE[&#39;MOD_FORM&#39;][&#39;REQUIRED_FIELDS&#39;].":<b>microGallery call =></b> <tt>folder={path/to/the/folder}</tt>";
endif;

$img_dir WB_PATH.MEDIA_DIRECTORY.&#39;/&#39;.$folder.&#39;/&#39;;
$img_url WB_URL.MEDIA_DIRECTORY.&#39;/&#39;.$folder.&#39;/&#39;;  

// directory exists --->
if (is_dir($img_dir)):
// open directory and go through the files
$dir dir($img_dir);

while (FALSE !== $image_file $dir->read()):

//use jpg, gif and png files only
if (!preg_match(&#39;/.+\.(jpeg|jpg|gif|png)$/&#39;, $image_file) || 
substr($image_file01) == "."
continue;
    
   /**
    * Make Array of images for the microGallery if image files exist
    */
// convert filenames into Titles    
$img_title str_replace(array(".png"".jpg"".gif"".jpeg"), ""$image_file);
$img_title str_replace("_"" "$img_title); 
if (isset($img_title) && !empty($img_title)):     
    $link $img_url.$image_file;    
    $group = isset($group) ? $group : &#39;&#39;; //ignore $group if &group Parameter isn&#39;t set in Droplet-Call
    $image_array[] = "<a class=&#39;colorbox&#39; href=&#39;".$link."&#39; rel=&#39;lightbox[".$group."]&#39; title=&#39;".$img_title."&#39;>file&#39;".$img_title."&#39;</a>";
    $linkonly[] = $link;
    $image_show[] = "<a class=&#39;colorbox&#39; href=&#39;".$link."&#39; rel=&#39;lightbox[".$group."]&#39; title=&#39;".$img_title."&#39;>
    <img src=&#39;"
.$link."&#39; alt=&#39;".$img_title."&#39; title=&#39;".$img_title."&#39; style=&#39;width:auto; height:120px; border:0;&#39;/></a>";
endif;
endwhile;

if(empty($image_show)): //no images in this directory
$output_value $MESSAGE[&#39;MEDIA&#39;][&#39;NONE_FOUND&#39;].&#39;: (<tt> &#39;.$img_url.&#39; </tt>)&#39;;
return $output_value;
endif;

/**
* DISPLAY microGallery
*/

$display  (isset($display)) ? $display : &#39;table&#39;;
$cssclass = (isset($cssclass)) ? &#39; class="&#39;.$cssclass.&#39;"&#39; : &#39;&#39;; //&cssclass=yourclass
// check sorting
if((isset($sort) && $display == &#39;table&#39;) || (isset($sort) && $display == &#39;all&#39;)){
if($sort==&#39;ASC&#39;) asort($image_show);
if($sort==&#39;DESC&#39;) rsort($image_show);
if($sort==&#39;RANDOM&#39;) shuffle($image_show);
}
switch ($display):
case &#39;table&#39;: //&display=table OR not-set at all
$picsperrow = (isset($cols)) ? $cols 4// Set the amount of pics per row
$output_value "<table".$cssclass."><tr>";
for ($i=0$i<count($image_show); $i++):
if (($i 0) && ($i $picsperrow == 0))
$output_value .= "</tr><tr>";
$output_value .= "<td>".$image_show[$i]."</td>";
endfor;
while ($i $picsperrow 0):
$output_value .= "<td>&nbsp;</td>";
$i++;
endwhile;
$output_value .= "</tr></table>";
break;
case &#39;all&#39;:  //&display=all
if(isset($sort) && $sort==&#39;ASC&#39;) asort($image_show);
if(isset($sort) && $sort==&#39;DESC&#39;) rsort($image_show);
if(isset($sort) && $sort==&#39;RANDOM&#39;) shuffle($image_show);
sort($image_show);
$output_value "<ul".$cssclass.">";
foreach ($image_show as $image){     
    $output_value .= &#39;<li>&#39;.$image.&#39;</li>&#39;;
}
$output_value .= &#39;</ul>&#39;;
break;
case &#39;first&#39;:  //&display=first
$output_value =  $image_show[0];
break;
case &#39;notfirst&#39;: //&display=notfirst 
array_shift($image_array); //skip first Element of Array
$output_value = &#39;<ul style="display:none">&#39;;
foreach ($image_array as $image){     
    $output_value .= &#39;<li>&#39;.$image.&#39;</li>&#39;;
}
$output_value .= &#39;</ul>&#39;;
break;

case &#39;firstlink&#39;: //&display=firstlink
$output_value =  $linkonly[0];
break;
endswitch;

// <-------end: if directory exists
else:
// directory doesn&#39;t exists --->
$output_value $MESSAGE[&#39;MEDIA&#39;][&#39;DIR_DOES_NOT_EXIST&#39;].&#39;: (<tt> &#39;.$img_url.&#39; </tt>)&#39;;
endif;    
return 
$output_value;

#m

Offline dbs

  • Betatester
  • **
  • Posts: 8146
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #72 on: August 20, 2011, 12:24:50 PM »
i test with 1.51 and the code is ok.
the leading <?php is not needed, but the modul remove this for you.

hm, what can be the problem?
droplet-name, desc or comment?

mic

  • Guest
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #73 on: August 20, 2011, 12:35:04 PM »
i test with 1.51 and the code is ok.
the leading <?php is not needed, but the modul remove this for you.

hm, what can be the problem?
droplet-name, desc or comment?

Hey, I just did it again and simply copied the presets for name, desc and comment - and it is all blue ;)

Now I'll see if I can get the gallery as such to work.

You pointed me the right way. Many thanks!

UPDATE: Alas, the gallery won't work.

The frontend spits:

Code: [Select]
Fatal error: Call to undefined function use_fancy_box() in /volume1/web/sandbox_wsb/modules/droplets/droplets.php(29) : eval()'d code on line 2
And that line (first part of file) reads:

Code: [Select]
<?php
/**
 *
 * @category        module
 * @package         droplets
 * @author          Ruud Eisinga (Ruud) John (PCWacht)
 * @author          WebsiteBaker Project
 * @copyright       2004-2009, Ryan Djurovich
 * @copyright       2009-2010, Website Baker Org. e.V.
 * @link http://www.websitebaker2.org/
 * @license         http://www.gnu.org/licenses/gpl.html
 * @platform        WebsiteBaker 2.8.x
 * @requirements    PHP 4.4.9 and higher
 * @version         $Id$
 * @filesource $HeadURL$
 * @lastmodified    $Date$
 *
 * droplets are small codeblocks that are called from anywhere in the template.
 *  To call a droplet just use [[dropletname]]. optional parameters for a droplet can be used like [[dropletname?parameter=value&parameter2=value]]\
 *
 *  1.0.2, bugfix, Reused the evalDroplet function so the extracted parameters will be only available within the scope of the eval and cleared when ready.
 *  1.0.3, optimize, reduce memory consumption, increase speed, remove CSS, enable nested droplets
 *
 */

function do_eval($_x_codedata$_x_varlist, &$wb_page_data)
{
extract($_x_varlistEXTR_SKIP);
return(eval($_x_codedata));
}

function processDroplets( &$wb_page_data ) {
// collect all droplets from document
$droplet_tags = array();
$droplet_replacements = array();
if( preg_match_all( &#39;/\[\[(.*?)\]\]/&#39;, $wb_page_data, $found_droplets ) )
{
foreach( $found_droplets[1] as $droplet )
{
if(array_key_exists( &#39;[[&#39;.$droplet.&#39;]]&#39;, $droplet_tags) == false)
{

Cheers!
#m
« Last Edit: August 20, 2011, 12:40:08 PM by mic »

Offline dbs

  • Betatester
  • **
  • Posts: 8146
  • Gender: Male
  • tioz4ever
    • WebsiteBaker - jQuery-Plugins - Module - Droplets - Tests
Re: [*droplet*] microGallery (place Gallery anywhere)
« Reply #74 on: August 20, 2011, 01:09:36 PM »
the droplet want work with colorbox.
a link to your site could help.