Developers: Help brainstorm plugin hooks

trisweb Administrator
This is something I'm going to need to do eventually, and I thought I'd get your input. We need to brainstorm and think of all the plugin hooks you could ever want in Zenphoto!

For those of you who don't know, a plugin hook is a function that always runs when some specific action happens in zenphoto, for example, there might be a hook called `p_on_submit_comment` (or something) that runs every time a comment is submitted, allowing a plugin author to, oh, I don't know, say, filter for spam (Yay! wooo! <small>hooray!</small>) or `p_on_load_image`, allowing you to do cool things to your images during processing. The possibilities are endless :-)

Other ideas off the top of my head:
  • Page load (album page, image page, any page, etc)
  • Image load (specific to thumbnails, all images, etc.)
  • Submit comment
  • ?
I'm not being very thorough, so go ahead and give me obvious ones too. Ready.... go!
«1

Comments

  • I would say
    On image upload for preprocessing images(landscape, portrait, added meta data...)
    On image process for manipulating the output of the image processor

    That is all I can come up with right now...
  • How about:
    On Thumbnail Generation (for some kind of run-time photo manipulation)
    On Picture Generation (for embedding watermarks or so)

    I guess these are similar to Chilifrei64's second suggestion.
  • trisweb Administrator
    And my second bullet as well ;-) Believe me, I know image manipulation plugins will perhaps be like a "killer app."

    Try to think of more general-use hooks that you might need.

    It's probably easy to add new ones once everything's all set up though, I just want to provide the best set possible when it's launched.
  • On_LogIn
    On_LogOut
    On_Sort
  • trisweb Administrator
    My own brainstorming... more as they come to me.

    - On Garbage Collection
    - On upload
    - On detection (album/image)
    - On download full-sized image?
    - On update (fieldname)
    - On delete (object)
    - On theme change
    - On plugin activation/deactivation
  • I really, really like the suggestion to embed watermarks on picture generation. It would save so much time now spent preparing images for upload.

    Once the hooks are defined, I just might consider developing the plugin. I know a couple of PHP libraries exist for EXIF manipulation. Pear has some for various image manipulations. I'll look thru them and see what I can find.

    Lee Eschen
  • Lee-

    I already have a non-plugin version of the watermarking functionality working. This will at least tide you over until Tristan gets the plugin hooks done. Let me know and I'll be glad to show you how I did it.

    You can see it in action either at:

    http://www.photosbydaisy.com/zenphoto/The+Bush+Family/3a.jpg (that's me and my family BTW)
    or
    http://www.thinkdreams.com/zenphoto/karson/IMG_4000.JPG

    Both of which should display the watermark in the lower right corner. The image is just a transparent 24-bit .png file you can make yourself with photoshop, and it just takes a few tweaks to the i.php and zp-config.php to make it work.

    (This might give you a jump to your plugin as well once the hooks are in place).
  • As I posted in another spot, DB hooks. Specifically toward custom fields in the DB, similar to the way Wordpress handles them so plugin authors can create custom fields via their plugins upon activation of the plugin. I'm not sure how deactivation would work (can it remove fields - thus losing data?) but it's a thought anyway.
  • I would love some programmatic access to be able to limit users' access to each admin tab. So perhaps a hook after requesting (but before returning) each of those pages? and a hook before writing the HTML for the admin menu?

    This would make it much easier to have a super-admin that has full editing and moderation of albums and comments, and then regular access so that users can add/edit their own albums, but not others' albums or any comments. (and then integrate the whole thing with Wordpress' roles/capabilities system)
  • trisweb Administrator
    Sounds like what you really want is a multi-user system, not just simple plugin hooks ;-)
  • Ha! Well, sure, I would take a multi-user system. But really, if I could programmatically control what gets displayed in the ZP admin interface, all of the multi-user logic can live in Wordpress, and it doesn't need to get duplicated for ZP.
  • Something that gets called when an admin page is loaded? I'm fiddling with a port of the WP Tiger Admin theme for ZP (mmm, integration) and it'd be spiffy to make that a plugin rather than just overwriting the admin CSS.
  • trisweb Administrator
    Yep, Admin hooks, great idea.
  • Add_User()
    Remove_User()
    On_User_Added()
    On_User_Removed()
  • thinkdreams wrote:

    I already have a non-plugin version of the watermarking functionality working. This will at least tide you over until Tristan gets the plugin hooks done. Let me know and I'll be glad to show you how I did it.

    <br>

    I'm sorry, thinkdreams, for not responding to this earlier. I got busy with stuff and just never got a "round tuit." Now that the holidays are almost over, maybe I can get back to the good stuff.
    <br>
    I thank you for the links for examples of your working watermarking. I would very definitely be interested in seeing just how you accomplished the task. Might you be able to email me the code (I presume it's PHP4/5).
    <br>
    And aside to trisweb: when can we expect the hooks to be 1: defined and 2: implemented? And what can we, the members here, do to help?

    Anticipating the very best ZenPhoto ever,
    Lee Eschen
  • I sure wish I could re-edit my post post when I see oops's in it.

    Lee
  • Getting into multiple users...

    Hooks to check permissions for the different users.
  • a preloading image!

    when loading, something like the AJAX stuff, show a small GIF when images are still loading... don't know if this is related but anyway,

    excellent work! love zenphoto!
  • hello,

    i hope i am right here in this topic now :D

    i have a real request, real because it would be cool (well cooler as cool)

    i start in a few days my photoshop battle net. and i thought it would be really cool to get the ability with zen to have a "mural" category for those mural photoshop battles.

    kinda 6-14 pictures side by side in one length .

    like:

    http://www.kranestyle.com/stuff/battles/shadowtouch/

    (sorry for the frame demo krane)

    so zen would be then the ultimate choice for photoshop battle forums.
  • trisweb Administrator
    @feryk, that's perfectly possible with the current zenphoto. You could make a theme where each albums' images are displayed side-by-side without space between, it's quite easy actually. And all you'd have to do is add images to the folder/album to build it up.
  • i thought more on a plugin like an extra category, because if id like to display two types i hafta install 2x zenphoto to display a mural and a regular gallery.

    so you say (in this constellation) that i need to install 2 zen's right?
  • trisweb Administrator
    So the plugin you'd want would be to select different themes for different albums. That's doable. Thanks for the suggestion.
  • This would be cool too.
  • i would say the ability to display both ways would be the right way (should be optional as individual album setting)
  • trisweb Administrator
    Yes, of course it would be optional. :-)
  • nice, havent seen a motivated coder since .... oh well :D
  • I'd like to see more than "thumbnail" and "photo" as rendering hooks. Specifically, I wish to author a plugin to display thumbnails that have been filtered (in my case, desaturated to grayscale) but use a hover/rollover effect to display the unfiltered thumbnail. For that I'd need to invoke URLs that indicate "thumbnail" and "highlight thumbnail" and have event hooks for both.
  • trisweb Administrator
    So, custom photo 'classes' essentially, or a filter set that's usable from a theme, or can be saved for each photo :-) That would be great! Thanks for the idea.
  • For future additions like RSS feeds, I'd think having hooks from adding/editing/deleting an album/image/comment may be a good way to architect it -- then the RSS component could be a plugin itself, and just update the feed on those events.
  • Dont know if these have already been suggested but:

    Event Hooks:

    on_login, on_newuser, on_logout for user based plugins

    on_comment, on_comment_edit, on_comment_delete for comment based plugins.

    on_main, on_gallery, on_image for the three most used page types.

    on_submit, on_edit, on_upload, on_delete, on_fulldownload for image uploading and editing, would make writing plugins which deal with each process much much easier.

    Variables and Globals:

    zpdb to be the main database class or whatever to enable plugins to utilise the database functions that zp uses.

    gallery_title, image_title self explanatory

    It would be nice to add search, tagging and rss support soon. Also to be able to select your own thumbnail sizes within the admin panel without having to edit files, as well as an on the fly image processing script so that a plugin which requires a different thumb size, etc can call it/the function.

    I could go on but I should have been in bed 4 and a half hours ago!
Sign In or Register to comment.