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.
Version 1.2 currently has English and German output.
attached french lang file
Thanks. Added to svn.
Version 1.3 adds a checkbox to update the timestamp of the replaced file.
Version 1.5 visually integrates to the new file menu (buttonlist).
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]
Quote from: thapame on July 08, 2010, 02:08:24 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?).
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.
Quote from: GameX32 on November 26, 2010, 09:14:14 AM
Some time and i see old picture
Clear your browser cache.
Quote from: GameX32 on November 26, 2010, 09:14:14 AM
i can do russian language file but i don't know how to share it.
Attach it as zip file to your next reply.
Russian lang file.
I browser cache - nothing change. Also i view file throw FTP - no change.
Quote from: GameX32 on November 26, 2010, 10:53:03 AM
Russian lang file.
Thanks. Added in svn revision 8082.
Please post a link to your gallery and a (non-admin) test user account which can upload pictures.
Link: cpg158.komptech68.com
User: Inspector
Pass: Outspector
I created one user album.
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).
Done.
The error message I expected:
QuoteThere 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.
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'.
The backslashes ('\') are stripped from file names on windows servers in tmp_name. That needs to be fixed, but I'm currently stuck.
Where I can find function $superCage->files->getRaw?
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?
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.
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.
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.
Does the simple upload form (HTTP upload) works for you on IIS?
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.
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.
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.
How to make this plugin work only for gallery owner?
Quote from: kodif on September 06, 2011, 11:54:12 AM
How to make this plugin work only for gallery owner?
In
codebase.php, find
$thisplugin->add_action('page_start','file_replacer_page_start');
$thisplugin->add_filter('file_data','file_replacer_id_data');
and replace with
if (GALLERY_ADMIN_MODE) {
$thisplugin->add_action('page_start','file_replacer_page_start');
$thisplugin->add_filter('file_data','file_replacer_id_data');
}
Italian lang file.
Quote from: ganesh on October 03, 2011, 01:12:00 PM
Italian lang file.
Added in svn revision 8260. Thanks for your contribution.
Finnish lang file (UTF-8)
Added Finnish language file in SVN revision 8503. Thanks for your contribution.
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.
Quote from: tassu on October 04, 2012, 08:16:08 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?
Quote from: Αndré on October 04, 2012, 09:14:54 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.
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?
Quote from: Α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?
That would be enough.
Plugin version 1.7 attached to initial post.
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).
That's intended. Maybe I'll add an option to update the file name.
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?
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.
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'
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?
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.
Use phpMyAdmin to:
- Back up the database
- In the _plugins table find the row with the plugin and delete the row.
Thank you Joe for you help! it works now :)
Hallo
Gibt es die Möglichkeit den Replacer für die Galleryversion 1.6 umzuschreiben, ich würde ihn gern weiter nutzen.
Danke Volker
Quote from: 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
Please only use English outside the language specific support boards.
Have you already tested if the current version works with cpg1.6.x?
Attached polish lang file
Thank you for your contribution. I just added it to the plugin repositories and also released an updated version of the cpg1.6.x version of the plugin.