EnlargeIt! AJAX GUI for CPG 1.5.x EnlargeIt! AJAX GUI for CPG 1.5.x
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

EnlargeIt! AJAX GUI for CPG 1.5.x

Started by Timos-Welt, January 05, 2009, 01:19:00 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Timos-Welt

What's this?
This plugin replaces the intermediate page with an AJAX gui that is widely configurable. EnlargeIt! turns the whole intermediate page into a pop-up-like window. It provides one of the fastest possible ways to browse a picture gallery.

This plugin works fine with any graphical web browser (Firefox 1.5 and higher, IE 5.0 and higher, Opera 8 and higher, Safari 3 and higher, Konqueror 3.5 and higher, Google Chrome ...), so you won't lose any visitors because of compatibility issues. Users without a Javascript-capable browser or who have deactivated scripting in their browser can use the gallery as if EnlargeIt! wasn't there at all. The whole plugin including the Javascript stuff is licensed under the GPL.

Features
* buttons for picture info, full size image, add to favourites, download, histogram
* navigation and close buttons
* navigation with arrow keys or mouse wheel (mouse wheel only with Mozilla & IE)
* seven different animation types
* chose animation speed and steps
* select border size, color and shadow
* centering and screen darkening (lightbox alike)
* enlarge to intermediate size or full size pics
* doesn't blow up your page size - only 24 Kbyte of javascript and 1 Kbyte of CSS is added
* support for flash files (SWF)
* support for playback of *.flv files - simply upload them to your CPG and they will play (filetype: *.flv)
* support for playback of *.divx files via DivX Web Player (http://labs.divx.com/WebPlayer) (filteype: *.divx)
* you can configure virtually everything on the config page - though it's not mandatory ;)

Demo gallery
http://bilder.timos-welt.de

Best practices

  • The more effect stuff you activate, the slower the animation will be on very old/slow computers. Turning off shadow, textured border and darkening will improve performance on these computers - it's up to you if you still like to be considerate of Pentium II and earlier...
  • Drag&drop, meaning sorting the enlarged pictures on the screen, only makes sense if you don't use the darkening feature. If you do use it, the visitor can only enlarge one pic at a time - not much to sort IMO ;)

Install
1. Copy folder enlargeit to your plugins folder.
2. Install via plugin manager. Configure with new admin button EnlargeIt!
3. If you update from a previous version, make sure to always completely uninstall the old version before installing the new one, and empty your browser cache afterwards.

Uninstall
1. Uninstall via plugin manager.

If it doesn't work

  • Check if the visitor has the right to access enlargeit.js (http://path.to.your.gallery/plugins/enlargeit/js/enlargeit.js) - the whole folder must be accessable via web by the visitors, because it contains the javascript and graphic files.
  • If the current version of this plugin doesn't work for you, you can find older versions here.
  • If you use a highly modded theme or a theme that doesn't provide valid HTML/XHTML, this plugin probably won't work. I can live with that, and you must! ;)

Credits
This plugin uses EnlargeIt! technology - http://enlargeit.timos-welt.de/
This plugin uses some icons from the free icon set 'Silk' - http://www.famfamfam.com/lab/icons/silk/
This plugin uses free FLV player by rphMedia - http://forum.coppermine-gallery.net/index.php/topic,43180.0.html
This plugin uses open source FLV player OSFLV - http://www.osflv.com/
Parts of this plugin are based on various MODs and plugins from the CPG forum by users Nibbler, Sami, rphMedia and others.

SVN:
https://coppermine.svn.sourceforge.net/svnroot/coppermine/branches/cpg1.5.x/plugins/enlargeit/

Download latest SVN snapshot:
http://coppermine.svn.sourceforge.net/viewvc/coppermine/branches/cpg1.5.x/plugins/enlargeit.tar.gz?view=tar

Please don't send any PMs to me regarding this plugin; reply to this thread instead. Thanks!

regards  ;)
Timo

Download:
Download from repository at sourceforge.net: http://sourceforge.net/projects/coppermine/files/Plugins/1.5.x/cpg1.5.x_plugin_enlargeit_v1.15.zip/download


Paver

I have found that RegEx filtering using the "page_html" hook can be very CPU-intensive on large thumbnail pages.  Pages either time-out or load very slowly, or in extreme cases, the web host shuts down your site due to excessive CPU load (this happened to a colleague's site).

I started looking at EnlargeIt to see how to use better plugin hooks - either current ones or ones to create - that will avoid filtering the whole page using "page_html".

If you have time, Timo, please suggest new plugin hooks if necessary for this plugin or any of your others to avoid this heavy filtering.  The dev team agreed on the Dev Board to allow the addition of new plugin hooks during the alpha phase of 1.5.  This will hopefully encourage plugin authors who are porting existing plugins to 1.5 to suggest new plugin hooks that are more efficient or just more useful.

Timos-Welt


SaWey

If you're having problems finding your way around the plugin API, don't hesitate to ask us

Timos-Welt

#5
Quote from: SaWey on January 07, 2009, 08:37:00 AM
If you're having problems finding your way around the plugin API, don't hesitate to ask us

It's not a plugin hook, but here's what I need to make the plugin very simple: EnlargeIt! modifies $template_thumbnail_view.

There's some variables/placeholders in there, e. g. {THUMB} or {CAPTION}.

I could remove nearly all of the regular expression stuff and the complete page_html filter, if six additional placeholders would be interpreted correctly for $template_thumbnail_view:
{PID} - The picture ID ($CURRENT_PIC_DATA['pid'])
{TITLE} - The picture title ($CURRENT_PIC_DATA['title'])
{PWIDTH} - The picture width ($CURRENT_PIC_DATA['pwidth'])
{PHEIGHT} - The picture width ($CURRENT_PIC_DATA['pheight'])
{FILEPATH} - The picture path ($CURRENT_PIC_DATA['filepath'])
{FILENAME} - The picture filename ($CURRENT_PIC_DATA['filename'])

Is it possible to teach the interpreter of $template_thumbnail_view these six variables?

regards
Timo

Edit: Forgot PWIDTH and PHEIGHT - they're neccassary for videos and flash files. Added filepath and filename.

SaWey

You might do this yourself, it is possible to override a theme function by just defining it in your plugin, just like you did with the template.
Have a look at this if you don't get what I mean: usergroups_alphatabs plugin (line 41)

Paver

Overriding a theme function is a bad idea.  It means that users have to modify all their themes they want to use/have available for users to conform to the plugin's requirements.

@Joachim: Can these tags be added to themes.inc.php and the sample theme (and all core themes that override the relevant function) during this alpha phase?  It can be written so that the current tags like {THUMB} are still processed so this doesn't force theme designers who are porting themes to use the new tags.

I think that it's very important to allow plugin and theme authors to avoid filtering final HTML, so adding these tags would be extremely helpful.

Optimizing plugins & themes, I think, is a good thing to do during the alpha phase.  Is this acceptable if the changes are minor changes like these?

SaWey

I think it is the same as overwriting a theme template, like he does in his plugin, which is the reason I mentioned it.
Of cource it is best to avoid overwriting.

Could you clarify some more where you would place those tags?

Paver

Quote from: SaWey on January 07, 2009, 11:30:50 PM
I think it is the same as overwriting a theme template, like he does in his plugin, which is the reason I mentioned it.
Overwriting any theme variables or functions in a plugin is a bad idea.  Unless I'm mistaken, we should strongly discourage plugin authors from doing so, because this makes the plugin difficult to use with many themes unless you make manual changes.   Plugins and themes should respect each other and not replace each other's code.

Quote from: SaWey on January 07, 2009, 11:30:50 PM
Could you clarify some more where you would place those tags?
The tags go into theme_display_thumbnails (with added array keys in display_thumbnails).  I've made the changes on my testbed and can commit them if it's OK to do so.  One alternative to adding these tags to the core is to add a plugin hook instead that allows a plugin (like EnlargeIt) to add these tags itself.  This might be preferred if adding more tags to a str_replace (from template_eval) is considered too much of a performance hit.  The new plugin hook would go into themes.inc.php, the sample theme, and other core themes as needed.  So new theme authors would have this plugin hook in the theme function.  Theme authors converting 1.4 themes would need documentation about adding this plugin hook, although it would be best as a general rule to tell theme authors to look at all functions and variables they overwrite to look for other changes in 1.5.

SaWey

I prefer the plugin hook over the tags, no need to have those variables there for most people.

Paver

I ran into a problem with implementing the plugin hook suggestion.  The problem is detailed here.

I have it running correctly now, with the changes to the Plugin API that I proposed in that thread.  Once that thread is resolved, I'll commit a plugin hook that will do what Timo wants and post a sample plugin here to show how to do so.

Paver

#12
I was misguided in my Plugin API problem (linked above), and so I reconsidered the plugin hook discussed here.

I committed the new plugin hook so it's ready to use.

Attached is a sample plugin showing how to use the new plugin hook.  It overrides $template_thumbnail_view since that's the simplest right now.  Looking through the core themes, no theme overrides the default (except the sample one of course).

Oh, the new hook is a filter hook named 'theme_display_thumbnails_params' and filters $params from theme_display_thumbnails().

edit: A link to the documentation with an example is here.


Timos-Welt

Absolutely great, thanks. I will do an adapted EnlargeIt! version to try it out.

Paver

A few notes (which will eventually make it into the plugin documentation as guidelines for all plugin authors):

* For plugin configuration, please use a button on the plugin manager page instead of one on the admin toolbar.  The admin toolbar quickly gets filled up when using many plugins.  You can use the "extra_info" in configuration.php to include both a configuration button and a support button like this (I also included a modification for $install_info for EnlargeIt! to note the new location of the configuration button):
$install_info = "You can configure the plugin after installation, use the button on the plugin manager. "
    . "If you want ImageFlow or Slider plugins to use EnlargeIt!, install them together with this plugin and switch the settings on their config pages.";
$extra_info = '<span class="admin_menu"><a href="index.php?file=enlargeit/plugin_config" title="Configure EnlargeIt!">EnlargeIt! Configuration</a></span> '
    . '<span class="admin_menu"><a href="http://forum.coppermine-gallery.net/index.php/topic,57424.0.html" rel="external" title="EnlargeIt! Support">EnlargeIt! Support</a></span>'
    . '<p>This plugin is currently an alpha version. Not all features will work, especially the AJAX parts (these will be completed after CPG 1.5.x is released). Thanks for understanding.</p>';

Some plugins' main function might require a button on the admin toolbar, but most plugins should just use a button on the plugin manager page.

* You can remove the plugin manager button from the title of your configuration panel.  For 1.4, this was a quick way to return to the plugin manager, but now 1.5 has a plugin manager button on the admin toolbar.

* $lang_continue is no longer a language variable.  You can use $lang_common['continue'] instead.  In your plugin_config.php, here are the relevant lines with a link back to the plugin manager page (which makes sense to me):
  // success note to user
  pageheader($lang_enlargeit['display_name']);
  msg_box($lang_enlargeit['display_name'], $lang_enlargeit['update_success'], $lang_common['continue'], 'pluginmgr.php');
  pagefooter();
  exit();


Timos-Welt

Just uploaded v0.3 - this one avoids regular expressions completely using the new plugin hook, though it may not yet work with all thumbnail settings from the config page. Thanks for your hints.

And yes: It's faster.

Joachim Müller

#16
Quote from: Hein Traag on March 27, 2009, 12:48:12 PM
Problem fixed with 1.2. Config page looks really dummy proof now, nice job!
Would be nice if this could link with EnlargeIt.
I must admit that I'm a bit reluctant to look into enlargeIt: it really looks very promising, but I just can't understand why it needs the extra file to go into the root, making it not a genuine plugin that way.

[Edit GauGau]
Split this posting and the next few ones from the thread that deals with the monitor calibration bar plugin and merged them with the thread that deals with enlargeIt.

Hein Traag

Not for you to worry about but for Timos (should he choose to use this or a other method of calibration in EnlargeIt).

Timos-Welt

Quote from: Joachim Müller on March 27, 2009, 02:14:12 PM
I must admit that I'm a bit reluctant to look into enlargeIt: it really looks very promising, but I just can't understand why it needs the extra file to go into the root, making it not a genuine plugin that way.

You're certainly not dumb, so I don't need to tell you what changes would be neccessary to certain core files to make EnlargeIt! a 'genuine' plugin. You already know it - simply give the core files a 'snippet' mode.

http://cpg/displayimage.php?pid=XX&snippet=info
=> Pic info snippet
http://cpg/displayimage.php?pid=XX&snippet=vote
=> Voting snippet
http://cpg/displayimage.php?pid=XX&snippet=comment
=> Comment snippet
http://cpg/ecard.php?pid=XX&snippet=yes
=> Ecard snippet

The question is: Do you actually want that? The core files will be more complicated in this case (the switch would lead to certain different CSS classes to be used which have to be part of the themes, links from snippet to snippet must be handled in a different way than now...), and EnlargeIt! would have to be an integral part of the whole project. The continuing friendly indifference of you as project leader and the whole dev team in the last 10 months gave me a completely different impression: Nice gimmick, but not interested. As long as this is the case, it's not a very good idea from your side to put the existence of the additional root files into question.

Nibbler

It's much simpler than that.

You just move the root files into the plugin's folder, and then change the urls you use from

enl_file.php

to

index.php?file=enlargeit/enl_file

Then Coppermine will include() the file from the plugin's folder. Much neater and much easier for the user.