usergallery thumbpage with 2 or more columns
-
lordcoffee
- Regular
- Posts: 308
- Joined: Tue Nov 29, 2005 10:22 pm
- Location: Munich - Germany
- Contact:
usergallery thumbpage with 2 or more columns
Hi!
I want to use the usergallery plugin but there is only one column in Thumbpage mode. Is it possible to show 2 or more?
Or is there a way that in mediagallery mode the "Fullsize images" open in a new window (popup)?
Thanks, Lordcoffee!
I want to use the usergallery plugin but there is only one column in Thumbpage mode. Is it possible to show 2 or more?
Or is there a way that in mediagallery mode the "Fullsize images" open in a new window (popup)?
Thanks, Lordcoffee!
-
mgroeninger
- Regular
- Posts: 546
- Joined: Mon Dec 20, 2004 11:57 pm
- Contact:
When I wrote the plugin there wasn't anyway to use popups with the mediagallery. I doubt that has changed, since it would have required substantial changes to the core functions that display the mediagallery... And it wouldn't be worth it just for this plugin...
The way the plugin stands right now the thumbnail page is rudimentary, ugly, and unconfigurable... that is because I don't have the css experience/knowledge to make it prettier...
If you (or anyone) have a css template they would like to see it use, post it here, send me a message, or send me an email with it...
Or, Garvin (if you read this), what is the best way to dive into Smarty? The staticpage plugin is complicated now... Is contactform a good place to look for how smarty works with Serendipity?
The way the plugin stands right now the thumbnail page is rudimentary, ugly, and unconfigurable... that is because I don't have the css experience/knowledge to make it prettier...
If you (or anyone) have a css template they would like to see it use, post it here, send me a message, or send me an email with it...
Or, Garvin (if you read this), what is the best way to dive into Smarty? The staticpage plugin is complicated now... Is contactform a good place to look for how smarty works with Serendipity?
Garvin reads everything. (The new motto for s9y.
)
Smarty is actually pretty easy. I added it to my newbox plugin with very little effort.
Basically, you make a PHP array. Then you use serendipity_getTemplateFile to make sure the template in question exists. Then you call serendipity_smarty_fetch to run the Smarty template on your array. What comes back is formatted HTML.
The only caveat is that the template has to be in your theme directory or your default directory. If its not, you can't find it. So you'll need some default to fall back on if the template file can't be found.
Smarty is actually pretty easy. I added it to my newbox plugin with very little effort.
Basically, you make a PHP array. Then you use serendipity_getTemplateFile to make sure the template in question exists. Then you call serendipity_smarty_fetch to run the Smarty template on your array. What comes back is formatted HTML.
The only caveat is that the template has to be in your theme directory or your default directory. If its not, you can't find it. So you'll need some default to fall back on if the template file can't be found.
-
mgroeninger
- Regular
- Posts: 546
- Joined: Mon Dec 20, 2004 11:57 pm
- Contact:
Judebert (since you beat Garvin to it *grin*),
Smarty can actually run loops, right? Does it make sense to build it so that the template itself loops through an array of images (rather than the plugin), so that people can build multi-column templates easily? Or am I thinking of something else?
lordcoffee,
I probably wont have time to work on this today but I might get some time later this week, hopefully...
Smarty can actually run loops, right? Does it make sense to build it so that the template itself loops through an array of images (rather than the plugin), so that people can build multi-column templates easily? Or am I thinking of something else?
lordcoffee,
I probably wont have time to work on this today but I might get some time later this week, hopefully...
Smarty can run loops in multiple ways. The {foreach} directive is probably your best bet.
Your plugin would loop through all the available images, doing whatever filtering it likes, to build a one-dimensional array of image URLs. (Smarty can handle multi-dimensional arrays, but we're going for the quick kill, here.) Each array entry could also contain stuff like a comment, title, flags, or whatever.
The Smarty template would loop through the array, adding a new table row (or however you want to do it) every n images. For instance, if you set your array using $serendipity['smarty']->assign('thumbnails', $myarray):
That would print a table of thumbnails, 3 wide, using the $thumbnails[n].link, .src, and .comment from your plugin.
Phew.
You could, of course, set up the cycle values in your plugin, too. Or pass a width option, and check a variable, like so:
That way your plugin could allow the user to configure the number of columns in his media gallery.
Your plugin would loop through all the available images, doing whatever filtering it likes, to build a one-dimensional array of image URLs. (Smarty can handle multi-dimensional arrays, but we're going for the quick kill, here.) Each array entry could also contain stuff like a comment, title, flags, or whatever.
The Smarty template would loop through the array, adding a new table row (or however you want to do it) every n images. For instance, if you set your array using $serendipity['smarty']->assign('thumbnails', $myarray):
Code: Select all
<table id="thumbnails">
{foreach from="thumbnails" item="thumb"}
{* print a <tr><td> for the first, <td> for second and third *}
{cycle values="<tr><td>,<td>,<td>"}
<a href="{$thumb.link}><img src={$thumb.src}><span>{$thumb.comment}</span></a>
{cycle values="</td>,</td>,</td></tr>"}
{/foreach}
</table>
Phew.
You could, of course, set up the cycle values in your plugin, too. Or pass a width option, and check a variable, like so:
Code: Select all
{foreach id="cols" from="thumbnails" item="thumb"}
{if $smarty.foreach.cols.iteration is div by $thumbnails.width}
<tr>
{/if}
<td>
...
-
lordcoffee
- Regular
- Posts: 308
- Joined: Tue Nov 29, 2005 10:22 pm
- Location: Munich - Germany
- Contact:
O.K., here you can see what I've done with the serendipty_event_usergallery.css and a little editing the php file. My Problem is that the Pictures and the borders do not fit in one horizontal line. Do you have an Idea what can fix this Prob?
There's nothing joining together the serendipity_gallery_thumbs and the serendipity_gallery_title. The titles are divs, so they're going directly below each other. I believe the thumbs are floated divs, so they get stacked to the left.
If you place the _title inside the _thumbs, I believe it'll do what you want.
Good Luck!
If you place the _title inside the _thumbs, I believe it'll do what you want.
Good Luck!
-
lordcoffee
- Regular
- Posts: 308
- Joined: Tue Nov 29, 2005 10:22 pm
- Location: Munich - Germany
- Contact:
O.K., thanks Judebert! The only Problem now is the size of the Thumbs.
The pictures in portrait format are higher than the landscape format pictures (of course they are
). Is there a way to set kind a minimal or maximal height?
HERE
Thanks, Lordcoffee!
The pictures in portrait format are higher than the landscape format pictures (of course they are
HERE
Thanks, Lordcoffee!
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Since Judebert already answered everything perfectly, I just wanted to acknowledge his statement of me reading everything
)
Best regards,
Garvin
Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
lordcoffee
- Regular
- Posts: 308
- Joined: Tue Nov 29, 2005 10:22 pm
- Location: Munich - Germany
- Contact:
-
lordcoffee
- Regular
- Posts: 308
- Joined: Tue Nov 29, 2005 10:22 pm
- Location: Munich - Germany
- Contact:
Now I get the "package-image" if a file is no image but the problem is that I used a static path to it:
Thanks, Lordcoffee!
How can I get this variabel? Because if anyone uses this plugin and his install directory isn't "blog" it won't work. Any Ideas?<a href="<?php echo $Fullimage; ?>" target=blank><img src="/blog/templates/default/admin/img/mime_unknown.png"></a>
Thanks, Lordcoffee!
-
lordcoffee
- Regular
- Posts: 308
- Joined: Tue Nov 29, 2005 10:22 pm
- Location: Munich - Germany
- Contact:
-
mgroeninger
- Regular
- Posts: 546
- Joined: Mon Dec 20, 2004 11:57 pm
- Contact:
lordcoffee,
it should be something like this:
Would you mind sharing your changes with me? I will probably still develop a smarty version of the plugin, but your css would save me a lot of work trying to make it look pretty...
it should be something like this:
Code: Select all
<a href="<?php echo $Fullimage; ?>" target=blank><img src="<?php echo serendipity_getTemplateFile('admin/img/mime_unknown.png'); ?>"></a>-
lordcoffee
- Regular
- Posts: 308
- Joined: Tue Nov 29, 2005 10:22 pm
- Location: Munich - Germany
- Contact:
Thanks to all!
Now the usergallery plugin works the way I wanted.
Take a look!
At last it would be nice to have a password field like the static_page_plugin to protect the "private"gallerys.
Greetings and good night,
Lordcoffee.
Now the usergallery plugin works the way I wanted.
Take a look!
At last it would be nice to have a password field like the static_page_plugin to protect the "private"gallerys.
Greetings and good night,
Lordcoffee.