[*droplet*] microGallery (place Gallery anywhere)

dbs

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:
<?php
case 'one':  //&display=one
$output_value =  $image_show[0];
array_shift($image_array); //skip first Element of Array
$output_value .= '<ul style="display:none">';
foreach ($image_array as $image){     
    $output_value .= '<li>'.$image.'</li>';
}
$output_value .= '</ul>';
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]
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

Stefek

So you've got a problem now. :-D

Bon chance.

Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

dbs

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
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

Stefek

#58
Hello guys,

look at the code:


<?php // ---> snippet

// check sorting
if((isset($sort) && $display == 'table') || (isset($sort) && $display == 'all')){
if($sort=='ASC'asort($image_show);
if($sort=='DESC'rsort($image_show);
if($sort=='RANDOM'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
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

dbs

QuoteAdded 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.
[url="https://onkel-franky.de"]https://onkel-franky.de[/url]

DJKat

#56
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
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

noname8

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:

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



noname8

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}

{MICROGALLERYADD} {TEXT_CURRENT_FOLDER}: {MEDIA_DIRECTORY}{CURRENT_DIR}


admin\media\browse.php:
line ~121, before // Insert values

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:


'INCLUDE_PATH' => WB_URL.'/include',
'MICROGALLERYADD' => $microgallerydirectory





[gelöscht durch Administrator]

Stefek

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
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

noname8

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_DIRECTORY.'/'.$folder.'/';

$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.
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 ?

noname8

Quote from: Stefek on November 09, 2010, 02:37:27 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

Stefek

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]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

noname8

#49
There was a problem with sorting:

Your 1.st post has typo:

Quote&sort Parameter:
Sort ascending, descending or random.
Use:
&order=ASC
&order=DESC
&order=RANDOM
(uppercase)

Should be &sort=  not &order=

But that did not work for me, so I used instead of line asort($image_show);
this one:


aksort($image_show);




function aksort(&$array,$valrev=false,$keyrev=false) {
 if ($valrev) { arsort($array); } else { asort($array); }
 $vals = array_count_values($array);
   $i = 0;
   foreach ($vals AS $val=>$num) {
       $first = array_splice($array,0,$i);
       $tmp = array_splice($array,0,$num);
       if ($keyrev) { krsort($tmp); } else { ksort($tmp); }
       $array = array_merge($first,$tmp,$array);
       unset($tmp);
       $i = $i+$num;
       // Fixed from previous post: $i = $num;
   }
}


//from php.net comments, auhor: mike at clear-link dot com



+ Thank you for this great (best) image gallery for wb

Stefek

You're welcome

(I forgot this is a english thread  :oops: :-P)

Kind regards,
Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

iradj


Stefek

Lieber Iradj,

ich muss gestern Deinen Post übersehen haben. Entschuldige.

Ich habe das Droplet so angepasst, dass es jetzt funktionieren sollte.
Magst Du es nachprüfen und bescheid geben?

Schönen Gruß,
Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

iradj


iradj

Hi Stefek,

How can I eliminate a subdirectory in the micro-gallery-directory?

With all the other files .txt, .php etc works very well.

Iradj

Stefek

Quote from: macsmet on September 22, 2010, 02:52:32 PM
Hi there,

I use the microGallery a lot because it is so very easy to use!
Lately I noticed that microGallery also shows the other files that is inside the folder.
It doesn't show a preview because these other files are no JPEG but ZIP files.
Is there a way to exclude ZIP files and/or only show JPEG files?

Greetings,

MacSmet
Hello MacSmet,

I updated the microGallery (first Post) and the mentioned issue should be handled now.
See also the new implementation of the $sort parameter.

Kind Regards,
Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Stefek

#42
Quote from: jamesypoo on October 31, 2010, 07:17:33 PM
Hi I was just wondering if you had been able to make it sort images by file name as requested a few posts above? This is a very valuable droplet to me and that one extra feature would make it perfect!

Thanks.

Hello Jamesypoo.

Just updated the microGallery Code (in first post).

This is the change of interest for you:

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


Udate the Dropletin your Droplet Console and apply in your [[droplet_call]]

&sort=ASC,
&sort=DESC or:
&sort=RANDOM

Please let me know if this worked for you.

Regards,
Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

Stefek

Hello,

Did you insert the droplet code to the Droplets Console (Admin Tool)?

If not, you cant use this droplet.
What do you mean with "my config"?

Regards,
Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

noname8

Quote from: Stefek on October 26, 2010, 10:23:20 PM
Hello nn8,

I must apologize, but I don't understand what you're asking for.

Regards,
Stefek

when I insert the droplet to any page, it outputs a text [[microgallery]]
I'd like to change it to my config wit selected parameters and a sample path.. possible?

Stefek

Hello,

there is no option to choose it now.

However, if you have some PHP skills, you may apply the PHP build in sort() function to do this.

Information here:
http://www.php.net/manual/en/function.sort.php

Kind regards,
Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden

jamesypoo

Hi I was just wondering if you had been able to make it sort images by file name as requested a few posts above? This is a very valuable droplet to me and that one extra feature would make it perfect!

Thanks.

Stefek

Hello nn8,

I must apologize, but I don't understand what you're asking for.

Regards,
Stefek
[i]"Gemeinsam schafft man mehr."[/i]

[b][url=http://duden.de/rechtschreibung/gemeinsam#Bedeutung1]gemeinsam[/url][/b]
1. mehreren Personen oder Dingen in gleicher Weise gehörend, eigen
2. in Gemeinschaft [unternommen, zu bewältigen]; zusammen, miteinander
#Duden