forum.coppermine-gallery.net

Support => cpg1.5 plugins => cpg1.5.x Support => cpg1.5 plugin contributions => Topic started by: Αndré on July 07, 2009, 03:34:14 pm

Title: File Replacer for cpg1.5.x
Post by: Αndré on July 07, 2009, 03:34:14 pm
This plugin will allow you and your users to replace files in your gallery with new ones. Installation is via the plugin manager, and will display a new button under the file in the intermediate/displayimage.php view.

This plugin is a port from the cpg1.4.x plugin 'File replacement (http://forum.coppermine-gallery.net/index.php/topic,21193.0.html)' created by Nibbler.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on December 30, 2009, 11:02:54 am
Version 1.2 currently has English and German output.
Title: Re: File Replacer for cpg1.5.x
Post by: François Keller on December 30, 2009, 12:23:14 pm
attached french lang file
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on December 30, 2009, 01:55:41 pm
Thanks. Added to svn.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on January 12, 2010, 04:47:16 pm
Version 1.3 adds a checkbox to update the timestamp of the replaced file.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on March 12, 2010, 02:11:59 pm
Version 1.5 visually integrates to the new file menu (buttonlist).
Title: Re: File Replacer for cpg1.5.x
Post by: thapame on July 08, 2010, 02:08:24 am
Hi,

This plug-in doesn't work properly with Remote videos for cpg1.5.x  [ http://forum.coppermine-gallery.net/index.php/topic,60195.0.html ] plugin.
I am getting an error message "The selected album/file does not exist!"

[Edit: Enabled clickable link]
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on July 08, 2010, 08:27:42 am
This plug-in doesn't work properly with Remote videos for cpg1.5.x
Works for me as expected. Please enable debug mode, post a link to your gallery, post a test user account and elaborate when the error occurs (what type of file do you try to replace, does the error occurs when you click on the replace button or when you try to upload the new file?).
Title: Re: File Replacer for cpg1.5.x
Post by: GameX32 on November 26, 2010, 09:14:14 am
Hello. I think this is very nice plugin, but it doesn't work for my cpg158. I enable debug mode but it tell nothing more than:

"\include\functions.inc.php
•Notice line 184: Undefined index: dbcharset"

It show new icon in menu, i press button, chouse new file(should it be same name?) and upload. Some time and i see old picture. Also i can do russian language file but i don't know how to share it.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on November 26, 2010, 09:19:46 am
Some time and i see old picture
Clear your browser cache.


i can do russian language file but i don't know how to share it.
Attach it as zip file to your next reply.
Title: Re: File Replacer for cpg1.5.x
Post by: GameX32 on November 26, 2010, 10:53:03 am
Russian lang file.
Title: Re: File Replacer for cpg1.5.x
Post by: GameX32 on November 26, 2010, 10:54:12 am
I browser cache - nothing change. Also i view file throw FTP - no change.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on November 26, 2010, 10:55:25 am
Russian lang file.
Thanks. Added in svn revision 8082.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on November 26, 2010, 10:57:00 am
Please post a link to your gallery and a (non-admin) test user account which can upload pictures.
Title: Re: File Replacer for cpg1.5.x
Post by: GameX32 on November 26, 2010, 11:01:51 am
Link: cpg158.komptech68.com
User: Inspector
Pass: Outspector

I created one user album.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on November 26, 2010, 11:12:03 am
Please update the plugin with this package (http://coppermine.svn.sourceforge.net/viewvc/coppermine/branches/cpg1.5.x/plugins/file_replacer/?view=tar) by replacing the old files with the new ones. It has an additional check if something wents wrong. Maybe we can find out what exactly happens with the error message (if it occurs).
Title: Re: File Replacer for cpg1.5.x
Post by: GameX32 on November 26, 2010, 11:17:27 am
Done.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on November 26, 2010, 11:23:22 am
The error message I expected:
Quote
There was an error moving the file 'C:WindowsTempphpBF83.tmp' to its destination 'albums/userpics/10002/Sun.jpg'


That's exactly the same issue that user (http://forum.coppermine-gallery.net/index.php/topic,67108.0.html) has. Please have a look at that thread. I don't know why it happens. Maybe we can find a fix together.
Title: Re: File Replacer for cpg1.5.x
Post by: GameX32 on November 26, 2010, 11:28:29 am
I'm not php expert, but we can try.

In line 63 $fileupload['tmp_name'] - where 'tmp_name' - generates or creates. There are no any other places in file with 'tmp_name'.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on November 26, 2010, 11:30:54 am
The backslashes ('\') are stripped from file names on windows servers in tmp_name. That needs to be fixed, but I'm currently stuck.
Title: Re: File Replacer for cpg1.5.x
Post by: GameX32 on November 26, 2010, 11:44:26 am
Where I can find function $superCage->files->getRaw?
Title: Re: File Replacer for cpg1.5.x
Post by: GameX32 on November 26, 2010, 11:55:28 am
I'm currently test some hack:

            $hack = $fileupload['tmp_name'];
            $hack = str_replace(":WindowsTempphp", ":\\Windows\\Temp\\php\\", $hack);

            if (!move_uploaded_file($hack, $image)) {
                cpg_die(ERROR, sprintf($lang_plugin_file_replacer['error_move_file'], $hack, $image), __FILE__, __LINE__);
            }

But it don't work. How 'C:WindowsTempphpF0D1.tmp' it actualy correct version?
Title: Re: File Replacer for cpg1.5.x
Post by: GameX32 on November 26, 2010, 11:57:35 am
Works for me:

            $hack = $fileupload['tmp_name'];
            $hack = str_replace(":WindowsTempphp", ":\\Windows\\Temp\\php", $hack);

            if (!move_uploaded_file($hack, $image)) {
                cpg_die(ERROR, sprintf($lang_plugin_file_replacer['error_move_file'], $hack, $image), __FILE__, __LINE__);
            }

Possible it can work on apache server too.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on November 26, 2010, 12:27:56 pm
So you're using IIS? Nice to hear that the hack works for you, but I try to find the 'real' solution before adding some hard-coded hacks. The file upload works for Coppermine for me (using Apache), so I may have a look at the appropriate code.
Title: Re: File Replacer for cpg1.5.x
Post by: GameX32 on November 26, 2010, 12:34:31 pm
Yes, ISS 7.5. I understand it, but my help possible useless in this question - i don't know php and can' locate function $superCage->files->getRaw. If you need some script to test on ISS i can help - just put file here and i upload it for test.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on November 26, 2010, 12:35:35 pm
Does the simple upload form (HTTP upload) works for you on IIS?
Title: Re: File Replacer for cpg1.5.x
Post by: GameX32 on November 26, 2010, 12:47:38 pm
Yes it works fine. But when i just install gallery it doesn't work. I use old style install and it determine gallery url as https. I fixed this and it's work. No any other modification.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on December 14, 2010, 05:26:01 pm
GameX32, please try the latest svn version (http://coppermine.svn.sourceforge.net/viewvc/coppermine/branches/cpg1.5.x/plugins/file_replacer/?view=tar) and confirm if it works for you on IIS.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on December 22, 2010, 03:52:20 pm
Version 1.6 (attached to initial post) has a check if the file was successfully moved on the server. It's now also compatible with the sef_url plugin and should work with IIS.
Title: Re: File Replacer for cpg1.5.x
Post by: kodif on September 06, 2011, 11:54:12 am
How to make this plugin work only for gallery owner?
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on September 06, 2011, 12:02:56 pm
How to make this plugin work only for gallery owner?
In codebase.php, find
Code: [Select]
$thisplugin->add_action('page_start','file_replacer_page_start');
$thisplugin->add_filter('file_data','file_replacer_id_data');
and replace with
Code: [Select]
if (GALLERY_ADMIN_MODE) {
    $thisplugin->add_action('page_start','file_replacer_page_start');
    $thisplugin->add_filter('file_data','file_replacer_id_data');
}
Title: Re: File Replacer for cpg1.5.x
Post by: ganesh on October 03, 2011, 01:12:00 pm
Italian lang file.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on October 05, 2011, 02:34:58 pm
Italian lang file.
Added in svn revision 8260. Thanks for your contribution.
Title: Re: File Replacer for cpg1.5.x
Post by: tassu on September 29, 2012, 01:41:50 pm
Finnish lang file (UTF-8)
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on September 29, 2012, 05:08:25 pm
Added Finnish language file in SVN revision 8503. Thanks for your contribution.
Title: Re: File Replacer for cpg1.5.x
Post by: tassu on October 04, 2012, 08:16:08 pm
It would be nice if you can update exif and iptc data at the same time with this plugin. And also could it update photo page title and description for that data too.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on October 04, 2012, 09:14:54 pm
update photo page title and description for that data too.
Do you mean some extra fields on the "choose file" page or automatically reading and replacing existing IPTC data?
Title: Re: Re: File Replacer for cpg1.5.x
Post by: tassu on October 12, 2012, 04:34:57 pm
Do you mean some extra fields on the "choose file" page or automatically reading and replacing existing IPTC data?
Yes, checkboxes like Update exif, update iptc, update title to page, update description to page would be really cool.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on October 12, 2012, 05:03:05 pm
The EXIF data will be automatically removed since the latest SVN commit. What do you mean with "update IPTC"? The only thing Coppermine does is to use that data for title, description and maybe some other things as far as I know. Please correct me if I'm wrong. So the only checkbox would be "overwrite existing meta data (title, description, ...) with IPTC data", correct?
Title: Re: Re: File Replacer for cpg1.5.x
Post by: tassu on October 13, 2012, 12:25:24 pm
The EXIF data will be automatically removed since the latest SVN commit. What do you mean with "update IPTC"? The only thing Coppermine does is to use that data for title, description and maybe some other things as far as I know. Please correct me if I'm wrong. So the only checkbox would be "overwrite existing meta data (title, description, ...) with IPTC data", correct?
That would be enough.
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on April 10, 2013, 02:35:05 pm
Plugin version 1.7 attached to initial post.
Title: Re: File Replacer for cpg1.5.x
Post by: netb on April 04, 2014, 01:15:19 am
When for instance try to replace a png file with a jpg it messes up, the file which is uploaded stays with the name of the old file and its file type (png).
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on April 04, 2014, 10:30:11 am
That's intended. Maybe I'll add an option to update the file name.
Title: Re: File Replacer for cpg1.5.x
Post by: Sunflowergirl on April 25, 2014, 10:22:40 pm
Hi, i love this plugin and use it on some of my galleries.
i just started a new gallery and wanted to use it but i can't. i can upload it but i can't install it.
I only get the "Critical error
There was an error while processing a database query" message. do you have any idea what that could be?
Title: Re: File Replacer for cpg1.5.x
Post by: Phill Luckhurst on April 25, 2014, 10:38:11 pm
To diagnose such a message we would need to see the debug output. Simple enable debug in the Coppermine config for the admin group then try and install. When you see your error message just below will be all the details of exactly which database error is occurring. If you could cut and paste that here we should be able to help further.
Title: Re: File Replacer for cpg1.5.x
Post by: Sunflowergirl on April 26, 2014, 12:07:29 am
ok, here are the details:

While executing query 'INSERT INTO cpg15x_plugins (name, path, priority) VALUES ('File replacer', 'file_replacer', 2)' in include/plugin_api.inc.php on line 448

mySQL error: Duplicate entry 'File replacer' for key 'name'
Title: Re: File Replacer for cpg1.5.x
Post by: Joe Carver on April 26, 2014, 12:48:40 am
Does it already show as an installed plugin in either your plugin manager or database?

Are you using a preexisting DB for the new gallery?
Title: Re: File Replacer for cpg1.5.x
Post by: Sunflowergirl on April 30, 2014, 09:37:18 pm
it's in the plugin manager but i can't install it.
the gallery is hosted through a fansite host, so i think it's on a preexisting DB but i'm not sure about it.
Title: Re: File Replacer for cpg1.5.x
Post by: Joe Carver on May 01, 2014, 12:56:27 am
Use phpMyAdmin to:
Title: Re: File Replacer for cpg1.5.x
Post by: Sunflowergirl on May 08, 2014, 09:33:37 pm
Thank you Joe for you help! it works now :)
Title: Re: File Replacer for cpg1.5.x
Post by: VolkerF on August 21, 2017, 11:40:32 am
Hallo

Gibt es die Möglichkeit den Replacer für die Galleryversion 1.6 umzuschreiben, ich würde ihn gern weiter nutzen.

Danke Volker
Title: Re: File Replacer for cpg1.5.x
Post by: Αndré on August 21, 2017, 07:39:57 pm
Hallo

Gibt es die Möglichkeit den Replacer für die Galleryversion 1.6 umzuschreiben, ich würde ihn gern weiter nutzen.

Danke Volker

Please only use English outside the language specific support boards.

Have you already tested if the current version works with cpg1.6.x?