Page 1 of 1

Plugin for multiple image insertions

Posted: Tue Nov 20, 2007 12:17 am
by VladaAjgl
Hi everyone, I made a new plugin for multiple image insertions, functionality that I missed in Serendipity. In short you write an xml structure in your entry and this plugin then replaces this xml structure by pictures from the media library. When you have fifty images and these images numbered in an ascending row, you can insert all of them on a single line.
Well now I see I should have better consulted the forum before. If I made something already existing, sorry for spam. If not, you will find it under these links:
plugin - http://vlada.ajgl.cz/myplugins/serendip ... insert.zip
documentation - http://vlada.ajgl.cz/myplugins/documentation_en.html

Re: Plugin for multiple image insertions

Posted: Tue Nov 20, 2007 12:19 pm
by garvinhicking
Hi!

That's an awesome idea! We've been lacking this a LONG time. Great work!

Maybe one small idea: We have a plugin, serendipity_event_imageselectorplus which deals with similar things. Would you maybe have the time to integrate your plugin into that existing one? (Of course with adding your credits to the files)

That would be great, and people would easier find that new functionality in that plugin...?

Best regards,
Garvin

Posted: Tue Nov 20, 2007 10:22 pm
by VladaAjgl
OK, I find the "small" idea reasonable. I didn't take care about imageselectorplus because I didn't know, what does it serve for. (And logically it surely won't be similar to my function :-) )... In fact, is there any documentation of this plugin?

I will watch this plugin more carefully and I will integrate my function in it.

And I have other ideas how to improve it. Maybe integration of multiple images selection to the pop-up window, where you select the images (you would not have to remember xml structure). For this - is there any possibility how to acces this image selector via plugin API? (such as event hook) Or is it necessary to hack the code of image selector?

Vladimir

Posted: Wed Nov 21, 2007 11:45 am
by garvinhicking
Hi!

Sadly we have little documentation. But the plugin is not that complex, so maybe you could have a look at its PHP file? I think it uses different event hooks, so you should be able to patch your plugin into that one? If not, raise your hand, I'll try to do it :)
And I have other ideas how to improve it. Maybe integration of multiple images selection to the pop-up window, where you select the images (you would not have to remember xml structure). For this - is there any possibility how to acces this image selector via plugin API? (such as event hook) Or is it necessary to hack the code of image selector?
I'm not really sure if that can be done. There are various event hooks (check out the templates/default/admin/media*.tpl files and the "hook" calls there). Plus, you'd need some javascript different than "serendipity_imageselector_done" which you can call by setting a $eventData variable ("finish_js" or something like it). Actually, the imageselectorplus plugin already contains some code in this direction.

HTH,
Garvin

Integrated

Posted: Fri Nov 23, 2007 4:45 am
by VladaAjgl
Hi,
I couldn't sleep tonight so I took a look at the integration of my function into ImageSelectorPlus.

It is to download at http://vlada.ajgl.cz/myplugins/serendip ... orplus.zip

I revised this plugin, understood what it actually does, added my credits into the description:-), added czech translation and documentation and found (and repaired) some bugs.

In fact, the main part of the plugin is about introducing selection of target of image links. This fonctionallity is already included in built-in media selector, I don't know from which version of s9y. If it is no necessary for back compatibility, it would be better to remove this parts of code.

Bug1 - repaired:
You may observe that "quickblog" doesn't work. It is in the case that you don't have quickblog.tpl template in your template directory or in the root of the web. Why? Because calling serendipity_getTemplateFile() function in imageselectorplus plugin returns name of nonexisting file. serendipity_getTemplateFile() function estimates, that if the template file has an extension ".tpl" and in its name is not "plugin", it is your core template file and it is up to your responsability to manage the right path to this file. It will not find the prepared template in the plugin directory. And this is the case of quickblog, because template file name is "quickblog.tpl". I fixed the trouble by renaming the template file to "plugin_quickblog.tpl" and changing appropriate lines in the code of the plugin.

Bug2 - is it bug in fact?:
When learning the functionality of the plugin, I tried its capability to show an image in the entry without displaying the entry - which is made by setting $eventData['clean_page'] = true; The way it is done makes, that in the next call of "entry_display" hook the eventData is empty. Which will stop the blog in case that there is at least one active plugin who doesn't make proofs, if there is any data in eventData before it uses it. The troubled plugin in my blog was GeoTag. ... So it is more than bug the warning not to use "special" features like clean_page.

Re: Integrated

Posted: Fri Nov 23, 2007 12:21 pm
by garvinhicking
Hi!

Hehe, thanks to your insomnia! ;)

I've gone through the patch, it looks great. I made a few minor indenting patches, change the version number, removed a few optional "?>" tags and just committed it.

I've undone the change of the "quickblog.tpl" template file removal, because this might break functionality for some people who would fall back to a default unmodified template file instead their customized one. Instead I adjusted the IF-check so that it should properly put the path to the right file, even without the "plugin_" prefix.

About the second bug: Yes, I believe the trouble is actually that other plugins should always check the $eventData. At least I don't know a different solution to provide the plugin the means to reset the page content...

Best regards,
Garvin

Posted: Sun Dec 02, 2007 12:31 pm
by VladaAjgl
Hi Garvin (hi others),
I made another improvement to this plugin. I added the ability of self-extracting of .zip files after upload. This will considerably help (at least it will help me :) ) when uploading many images at once. And I offer this functionality to other serendipity users.

Available at: http://vlada.ajgl.cz/myplugins/serendip ... _v0.22.zip

P.S. I edited the file where you fixed quickblog bug (that I introduced in my last editation, shame on me).

Posted: Mon Dec 03, 2007 12:20 pm
by garvinhicking
Hi!

Hey, cool. Keep things like this coming. :-) :-)

Committed to CVS!

Regards,
Garvin