Media library as gallery?

Creating and modifying plugins.
Post Reply
treehstn
Regular
Posts: 31
Joined: Wed May 09, 2007 2:12 am

Media library as gallery?

Post by treehstn » Sun May 13, 2007 8:26 pm

Is there a plugin or setting that makes the existing Media library appear like a photo gallery to my visitors?

Thanks!

mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger » Mon May 14, 2007 1:59 am

You should look at the "Gallery Display" event plugin (also called "serendipity_event_usergallery").

You can see a simple example at my website if you need.

treehstn
Regular
Posts: 31
Joined: Wed May 09, 2007 2:12 am

Post by treehstn » Mon May 14, 2007 3:52 am

Awesome!!! It worked perfect! Can anyone tell me where the setting is to change the title on that page? The one that has gallery written in lower case letters is the text that I want to change.

http://cblog.cessnapilot.net/index.php? ... llery.html

Thanks!!!

mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger » Mon May 14, 2007 5:11 am

Can anyone tell me where the setting is to change the title on that page? The one that has gallery written in lower case letters is the text that I want to change.


That actually comes from the name of the folder you are sharing out (I think). So if you change the "Pick a default directory" option it should change the text displayed. If you share out all the directories it defaults to "gallery".

I actually only share out a subfolder of the media library, so that I can put images up on the server without publishing them on the gallery page (if that makes sense).

treehstn
Regular
Posts: 31
Joined: Wed May 09, 2007 2:12 am

Post by treehstn » Mon May 14, 2007 5:53 am

That worked great! Thanks!

dom97
Regular
Posts: 20
Joined: Sun Feb 18, 2007 9:59 pm

Post by dom97 » Tue May 15, 2007 3:20 am

Is there a way to make the listing in two columns horizontal instead of in one long list on the left.



[/img]

mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger » Tue May 15, 2007 7:34 am

Wow... you have far more folders than I had ever really considered!

:D

Unfortunately, there isn't a way to do it with the default settings in the plugin.

However, the plugin is _really_ flexible if you are willing to play with the tpl files.

Basically, I would suggest that you copy the file "plugin_usergallery.tpl" into your template directory and then look at changing it a bit.

I'm not very good with css, but I think there would be a pretty easy way to make it two column. If you look in that file and find this section:

Code: Select all

      <!-- album list -->
      {if $plugin_usergallery_dir_list eq 'yes'}
      {if $plugin_usergallery_display_dir_tree eq "yes"}
      <!-- basefolder in treeview -->
      <a href="{$plugin_usergallery_httppath}">{$plugin_usergallery_title} ({$plugin_usergallery_maindir_filecount} images)</a>
      {else}
         {if $plugin_usergallery_toplevel eq 'no'}
      <!-- 'up-one-level' link in galleries-->
      <a href="{$plugin_usergallery_httppath_extend}gallery={$plugin_usergallery_uppath}">{$const.uponelevel}. ({$plugin_usergallery_maindir_filecount})</a>
         {else}
      <!-- basefolder in listview -->
      <a href="{$plugin_usergallery_httppath}">{$plugin_usergallery_title} ({$plugin_usergallery_maindir_filecount} images)</a>
         {/if}
      {/if}
         <br />
      <!-- folders -->
         {foreach name="dir_list" from=$plugin_usergallery_subdirectories item="dir"}
        <span style="margin-left: {math equation="x * 10" x=$dir.depth}px;"><a href="{$plugin_usergallery_httppath_extend}gallery={$dir.relpath}">{$dir.name} ({$dir.filecount} images)</a></span><br />
         {/foreach}
      {/if}
      <!-- end album list -->


That is what controls the output of the list, with the part after "<!-- folders --> " outputting the actual folder list. The simplest way to do two column would be something like

Code: Select all

<!-- folders -->
<table>

{foreach name="dir_list" from=$plugin_usergallery_subdirectories item="dir"}

{if $smarty.foreach.dir_list.iteration % 2 == 1}
  <tr>
  {assign var=open value=1}
{/if}

<td><a href="{$plugin_usergallery_httppath_extend}gallery={$dir.relpath}">{$dir.name} ({$dir.filecount} images)</a></td>

{if $smarty.foreach.dir_list.iteration % 2 == 0}
  </tr>
  {assign var=open value=0}
{/if}

{/foreach}
{if $open}
  <td colspan=2 >&nbsp;</td></tr>
{/if}
</table>


That doesn't put any column spacing in, and it destroys the folder/subfolder relationship, but it might give you a start.

And if any of the template wizards peek in this thread feel free to offer any suggestions!

Post Reply