forum.coppermine-gallery.net

Support => cpg1.5 plugins => cpg1.5.x Support => cpg1.5 plugin contributions => Topic started by: Αndré on July 02, 2014, 02:37:47 pm

Title: Edit picture views plugin for cpg1.5.x
Post by: Αndré on July 02, 2014, 02:37:47 pm
This plugin allows you to edit the picture views on the editpics.php form, if you are logged in as admin. There's no configuration. Just install the plugin and you can edit the picture views, see attached screenshot.

Title: Re: Edit picture views plugin for cpg1.5.x
Post by: casp3r on July 02, 2014, 02:47:06 pm
Αndré works perfectly. Again many, many thanks :)
Title: Re: Edit picture views plugin for cpg1.5.x
Post by: Αndré on July 02, 2014, 02:52:44 pm
This plugin could be extended so it can also be used on the edit_one_pic.php form. But as you haven't asked for it in your support thread, I haven't implemented it yet.
Title: Re: Edit picture views plugin for cpg1.5.x
Post by: casp3r on July 02, 2014, 02:54:31 pm
The multli picture edit is all that I need :)
Title: Re: Edit picture views plugin for cpg1.5.x
Post by: lsuarez on October 17, 2014, 08:39:47 pm
I have tried to get this to work. I need to import a lot of pictures from Twitpic, as this service is shutting down on the 25th of October. I want to keep the views the same as they were on Twitpic. Anyway, when I try to upload the plugin via the web uploader, nothing seems to happen. I have installed the unzipped file via ftp. The folder is there. But when I go to the editpics.php, I can't edit the views...

What have I done wrong?
Title: Re: Edit picture views plugin for cpg1.5.x
Post by: Αndré on October 17, 2014, 09:08:55 pm
Have you actually installed the plugin after you uploaded it to the plugins directory? http://documentation.coppermine-gallery.net/en/plugins.htm#plugin_manager_install
Title: Re: Edit picture views plugin for cpg1.5.x
Post by: lsuarez on October 18, 2014, 07:17:27 am
The things that a person can accomplish when actually thinking while doing them... amazing! But seriously, I don't know how I managed to overlook this... Must be my being new to Coppermine. N00bs...  ::)

Thanks for your help and understanding.
Title: Re: Edit picture views plugin for cpg1.5.x
Post by: lsuarez on December 22, 2014, 12:46:10 pm
New question: when I upload video files, I don't seem to be able to edit the views. There's just no editable field. How can I do this?
Title: Re: Edit picture views plugin for cpg1.5.x
Post by: Αndré on December 22, 2014, 08:46:42 pm
I just uploaded a test video to an album with an existing test picture. Unfortunately, the edit pics form doesn't work as expected in that scenario. That's a bug of the plugin. I'll try to fix it as soon as possible.
Title: Re: Edit picture views plugin for cpg1.5.x
Post by: Αndré on December 22, 2014, 09:47:26 pm
In codebase.php, try to replace the whole function edit_pic_views_page_html with
Code: [Select]
function edit_pic_views_page_html($html) {
    global $lang_editpics_php, $lang_common;

    // we need to replace the HTML code of the video files first
    $replace = '<input type="hidden" name="pid[]" value="'."\\1".'" />';
    $replace .= sprintf($lang_editpics_php['pic_info_str'], '<input type="text" name="pwidth'."\\1".'" value="'."\\2".'" size="5" maxlength="5" class="textinput" />', '<input type="text" name="pheight'."\\1".'" value="'."\\3".'" size="5" maxlength="5" class="textinput" />', "\\4", '<input type="text" name="hits'."\\1".'" value="'."\\5".'" size="8" class="textinput" />', "\\6");
    $html = preg_replace('/<input type="hidden" name="pid\[\]" value="([0-9]+)" \/>[\s]*'.str_replace('%s', '([0-9]+)', str_replace('%s &times; %s', '<input type="text" name="pwidth[0-9]+" value="%s".*\/> &times; <input type="text" name="pheight[0-9]+" value="%s".*\/>', $lang_editpics_php['pic_info_str'])).'[\s]*<\/td>/Ui', $replace, $html);

    // non-movie files
    $replace = '<input type="hidden" name="pid[]" value="'."\\1".'" />';
    $replace .= sprintf($lang_editpics_php['pic_info_str'], "\\2", "\\3", "\\4", '<input type="text" name="hits'."\\1".'" value="'."\\5".'" size="8" class="textinput" />', "\\6");
    $html = preg_replace('/<input type="hidden" name="pid\[\]" value="([0-9]+)" \/>[\s]*'.str_replace('%s', '([0-9]+)', $lang_editpics_php['pic_info_str']).'[\s]*<\/td>/Ui', $replace, $html);

    return $html;
}
Title: Re: Edit picture views plugin for cpg1.5.x
Post by: lsuarez on December 24, 2014, 09:21:55 am
Works! Genius!  :D
Title: Re: Edit picture views plugin for cpg1.5.x
Post by: Αndré on January 10, 2015, 07:40:35 pm
Added support for video files in version 1.1 (attached to initial post).
Title: Re: Edit picture views plugin for cpg1.5.x
Post by: Αndré on November 06, 2018, 09:40:39 pm
Version 1.2 (attached to initial post) fixes a possible permission issue.
Title: Re: Edit picture views plugin for cpg1.5.x
Post by: Bkangel1505 on May 20, 2019, 06:47:01 pm
This plugin seems to no longer work for me. Is there a fix?
Title: Re: Edit picture views plugin for cpg1.5.x
Post by: Αndré on May 21, 2019, 03:11:36 pm
Works for me as expected with cpg1.5.48. What exactly doesn't work for you?