Page 1 of 1

Media library as gallery?

Posted: Sun May 13, 2007 8:26 pm
by treehstn
Is there a plugin or setting that makes the existing Media library appear like a photo gallery to my visitors?

Thanks!

Posted: Mon May 14, 2007 1:59 am
by mgroeninger
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.

Posted: Mon May 14, 2007 3:52 am
by treehstn
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!!!

Posted: Mon May 14, 2007 5:11 am
by mgroeninger
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).

Posted: Mon May 14, 2007 5:53 am
by treehstn
That worked great! Thanks!

Posted: Tue May 15, 2007 3:20 am
by dom97
Is there a way to make the listing in two columns horizontal instead of in one long list on the left.



[/img]

Posted: Tue May 15, 2007 7:34 am
by mgroeninger
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 > </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!