Problems while developing an extended gallery plugin

Creating and modifying plugins.
Post Reply
docjo
Posts: 4
Joined: Thu Feb 28, 2008 11:26 am
Location: Erfurt, Germany
Contact:

Problems while developing an extended gallery plugin

Post by docjo »

Hi at all...

first of all, I really like s9y. It's a great blog/cms system. The only thing I've encountered is that there isn't any really good gallery feature. I tried almost every plugin for all the external gallery sites, but this is all quite long-winded. Why should I maintain to sites, one for my photos and one for my blog if s9y already supports a really good media library which is able to handle a lot of photos quite easily.
The only plugin which almost do what I imaging is the usergallery plugin.
So I decided to modified this plugin, so that it fits my needs.
In the end it looks like on my New Zealand blog here:
http://kiwis.beeyou.de/index.php?/pages/gallery.html

What I want was:
  • - a gallery which can handle multiple albums on folder basis
    - an easy navigation through an album and preview of an whole album at once
    - title and description for every single photo
    - ability to comment every photo
    - integrates completely and smooth in the admin suite
The problem on this is, that I made many changes in the admin area, so the current version is quite dirty programmed.

Now I started to develop a complete new version with "clean" code and so
I encountered many problems especially with the last point of the list.

In the "dirty" version I added a new symbol for every picture in the media gallery with which it is possible to add an title and description to all these files like in the picture below:

Image

Furthermore I extended the "manage directories" section, so that everytime a new folder is created the usergallery plugin determines if the folder should be an album. For that reason I added a new text field in the
create directory dialog, for the display name of the album. If this is filled
the new folder is added as album.

My problem is, that I haven't found sufficient event_hooks for the changes in the admin suite...and I would like to develop this plugin without new hooks. Is this possible?

Another thing is, that I make use of the static page plugin exactly like the usergallery plugin. But the thing is, that I only use Smarty for the output. Since I changed completely to Smarty for all the output stuff the page is displayed really weird and wrong. The way it should look is like on my blog mentioned above.
The way it looks now on my testblog is like that:

Image

If I take a look directly into the source code of the site all div containers are in the right order...but my firebug don't share this opinion...like the arrows in the picture above shows. Has this something to do with the staticpage plugin?

Btw, I haven't found something general for how to use Smarty templates in a s9y plugin. I just took the stuff from the guestbook plugin...it seems to work...however with the wrong behavior like the picture tells.

I really would appreciate it, if someone can give me some hints what I could doing wrong with the templating thing and how I can solve the problems with the backend event hooks. Of course I would also post my code if it is necessary.

Hope someone can help.

Jonas
Everyone seems to have a clear idea of how other people should lead their
lives, but none about his or her own.
docjo
Posts: 4
Joined: Thu Feb 28, 2008 11:26 am
Location: Erfurt, Germany
Contact:

Post by docjo »

Hm...ok I solved the strange display behavior with the wrong ordered divs...I forgot to replace an closing </td> tag with an closing </div> tag...
how stupid! :(

So don't bother about this anymore. Much more important is the backend event hook problem.
Everyone seems to have a clear idea of how other people should lead their
lives, but none about his or her own.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Problems while developing an extended gallery plugin

Post by garvinhicking »

Hi!

If there are no sufficient event hooks in the backend, of course they need creation. :-)

If they are of public/general use, I see no problem to add them into the s9y release.

HTH,
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/
judebert
Regular
Posts: 2478
Joined: Sat Oct 15, 2005 6:57 am
Location: Orlando, FL
Contact:

Post by judebert »

I guess the real question is, "What hooks do you want?"

If you can describe for us the circumstances under which you want a hook to be called, we can tell you if a hook already exists -- or create a new one. Hooks aren't extremely lightweight, but they're light enough that Garvin is willing to add them in cases where more than one use is even slightly possible.

Let us know!
Judebert
---
Website | Wishlist | PayPal
azel
Regular
Posts: 265
Joined: Thu Apr 21, 2005 4:28 am
Contact:

Post by azel »

That is awesome! If you do release this as a plugin, it would be super-dandy if it could also be used to pull images from flickr to display in your blog. I kinda gave up on the idea of hosting my own images, mostly because the galleries I tried didn't have simple features I wanted.

That gallery looks excellent though!
docjo
Posts: 4
Joined: Thu Feb 28, 2008 11:26 am
Location: Erfurt, Germany
Contact:

Hooks, eye patches and something more...

Post by docjo »

Thanks a lot for your reply... so I guess I have to be a bit more precise about what kind of hooks I need.

I saw that is now possible to add media information like title and comments for each picture so I should be able to just read that information from the table.

So my problems are in the area of folder management.
  • 1. I need a hook in the images.inc.php in the function directoryCreate where I can put additional input fields for a new directory.
    2. To manage what to do with this additional information I also need a hook in the directoryDoCreate function.
    3. To remove the album from the database if the folder is deleted it is also necessary to have a hook in the directoryDoDelete function.
That's all I guess. The flickr thing sounds also interesting, but first I would like to finish this stuff.

I know I could easily just make a new menu option in the admin menu where I just put all the stuff needed for the plugin...but I really want to integrate this thing into the existing folder management of s9y.
Everyone seems to have a clear idea of how other people should lead their
lives, but none about his or her own.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Hooks, eye patches and something more...

Post by garvinhicking »

Hi!

I just committed those new hooks to Serendipity:

http://svn.berlios.de/viewcvs/serendipi ... 1&view=rev

Please check out those updated files and see if the new hooks suit your needs?

About 2: In the 1.3 version of s9y, a new hook "backend_directory_create" was already added, you should be able to use that.

I'm really curious about your finished plugin, please let us know about it :)

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/
docjo
Posts: 4
Joined: Thu Feb 28, 2008 11:26 am
Location: Erfurt, Germany
Contact:

A little problem...

Post by docjo »

Hi Garvin,

thanks for the hooks, they are working perfect!

But I still have another little thing...
I'm creating a folder for thumbnails inside the album folders and I'm
able to exclude them from traversing...but only in regard to the media library. I also want to hide these thumbnail folders from the directory management and the add media section.
So it would be nice, if it would be possible to add an general exclude directory to the serendipity_traversePath function. There are already the CVS and SVN directories as standard exclude directories.

Another thing is, that I am currently unable to use the comment functions of s9y for commenting to images. In the ugly version of the plugin I changed some comment functions of s9y so that they were able to distinguish between comments for entries and for images. Now I'm creating some comment functions directly into the plugin...but I'm not sure if this is an elegant way. Any opinions are very welcome...

Thanks in advance :-)

Jonas
Everyone seems to have a clear idea of how other people should lead their
lives, but none about his or her own.
mgroeninger
Regular
Posts: 546
Joined: Mon Dec 20, 2004 11:57 pm
Contact:

Post by mgroeninger »

Hi Jonas,

Thanks for working on the usergallery plugin! Those features are stuff I have been meaning to do but have never had time to get to. You have already tackled most of the problems that I felt I didn't have time to wrestle with!

As far suggestions on the comment system, I think a separate comment system would be a lot easier, but I like the idea of being able to approve/control all the comments in one place. And using the core comment system brings a lot of well tested code to the table (like captchas, spam control hooks and approve/delete), while coding a new system means duplicating some portion of that.

You should probably ask Garvin what he thinks of specific changes to the comment system and go from there. I am sure that if there is a nice way to make the comment system more extensible he would probably be ok with changing core functions. I had envisioned either adding a field to the table to specify type (relatively easy if Garvin approves) or seeing if there is a nice way to encode comment ids to differentiate between types of comments (Convoluted and full of trickery, but less disruptive to core).

The biggest requirement I had and would like to see in any changes is the ability to turn comments on and off, both completely and per image. Obviously using the core comment system makes that a lot easier, but per image would probably still need some work to implement right.

As for the image directory, I thought it would be easier to just allow a user to specify an image that currently exists in the media library to be associated with a folder. I wasn't planning to introduce another thumbnail (or a thumbnail directory) to the situation... That being said, I don't know how you have it implemented, so I don't know the benefits/disadvantages of the two ways.

Anyways, thanks again for working on this! It sounds great!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: A little problem...

Post by garvinhicking »

Hi!
But I still have another little thing...
I'm creating a folder for thumbnails inside the album folders and I'm
able to exclude them from traversing...but only in regard to the media library. I also want to hide these thumbnail folders from the directory management and the add media section.
So it would be nice, if it would be possible to add an general exclude directory to the serendipity_traversePath function. There are already the CVS and SVN directories as standard exclude directories.
Phew. I can understand that need, but the traversePath function is called quite often, and I'm afraid of the performance implications it will have if we add an event hook call to that system. I'm not really in favor of that, how about another approach: We could setup a global $serendipity['...'] variable that contains a list of exclusion directories. Your plugin could modify that variable inside the backend_configure hook?
Another thing is, that I am currently unable to use the comment functions of s9y for commenting to images. In the ugly version of the plugin I changed some comment functions of s9y so that they were able to distinguish between comments for entries and for images. Now I'm creating some comment functions directly into the plugin...but I'm not sure if this is an elegant way. Any opinions are very welcome...
Well, if it can be done to "bend" the s9y core commenting functionality to expand to images, I'd surely appreciate this. But I bet that's a lot of work...?

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/
Post Reply