March 20, 2010, 07:43:43 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: cpg1.4.26 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.4.25 or older update to this latest version as soon as possible.
[more]
   Home   Help Search Board rules Login Register  
Pages: [1] 2   Go Down
  Print  
Author Topic: File replacement plugin  (Read 27751 times)
0 Members and 1 Guest are viewing this topic.
Nibbler Topic starter
Dev Team member
****
Gender: Male
United Kingdom United Kingdom

Posts: 19610



WWW
« on: August 26, 2005, 03:55:09 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 present a new button under the file in the intermediate/displayimage.php view.

* file_replacer.zip (2.16 KB - downloaded 1079 times.)
Logged

I don't care about what they say, I won't live or die that way.
flashi
Coppermine newbie

Gender: Male
Posts: 4


WWW
« Reply #1 on: February 11, 2006, 03:50:50 pm »

Hi all  Smiley

I love coppermine and wanted to say thx to all the developers out there, really great work.

I have a big problem with access rights at the moment...

I installed the File Replacement-Plugin a few days ago because I decided to change the quality of all my pictures without losing the number of views of each photo. Everything worked really fine, but today I realized a strange thing:

When I upload a completely new file / photo to the gallery, coppermine chmods it with 666, everything fine so far.
But if I replace a file with the File Replacement-Plugin, coppermine sets chmod to 600, so I can't change anything via ftp after it   Shocked

Cause I make backups regularly via ftp-download of the whole site, that isn't possible any longer. I don't have the rights to download the replaced files via ftp, and I can't change the rights via ftp to 666 to correct this, I get a "Operation not permitted"  Sad

Could someone please help me to correct this? I don't know PHP very well, is there a possibility to set chmod to 666 when I replace a file with the plugin as coppermine do as default when uploading a new file?

Thanks to all out there for help, keep up your great work.

flashi
Logged
Nibbler Topic starter
Dev Team member
****
Gender: Male
United Kingdom United Kingdom

Posts: 19610



WWW
« Reply #2 on: February 11, 2006, 04:03:19 pm »

Look in the plugin's codebase.php for

Code:
move_uploaded_file($_FILES['fileupload']['tmp_name'], $image);

and add after it

Code:
chmod($image, octdec($CONFIG['default_file_mode']));
Logged

I don't care about what they say, I won't live or die that way.
flashi
Coppermine newbie

Gender: Male
Posts: 4


WWW
« Reply #3 on: February 11, 2006, 04:09:55 pm »

Wow, that was a fast solution  Shocked

I thank you very much, everything works fine now  Grin
Logged
LilAngel
Coppermine novice
*
Afghanistan Afghanistan

Posts: 39


« Reply #4 on: February 19, 2006, 02:55:19 pm »

Great plugin!
I used to manually replace the files on the FTP and then rebuild thumbs and resized pictures, but this is by far more easier.
Logged
Beyond_Doubt
Coppermine newbie

Posts: 18


« Reply #5 on: February 26, 2006, 11:55:55 pm »

This is a plugin that fits my needs 100% Smiley

Tha problem is that I am using the mod'ed CPG to suit PragmaMX.
I realise this isn't an issue for this board, but just to keep things all above board I thought it courteous to let you know I was asking for help on the PragmaMX forum to adapt your work to suit.

I trust that this is not a problem for you. Smiley

Quote
Appologies, but this is an English only post; I know no German.

I have a PragmaMX installation with MX-CPG 1.4.3.
In that installation I have added a few Plugins from the CPG site.
Some of these Plugins required small modifications to the codebase.php before they would work.
Usually this modification was just to change...
Code:
require ('plugins/control_fullsize/include/init.inc.php');
to
Code:
require (dirname(__FILE__).'/include/init.inc.php');


However I am very eager to use the 'File Replacer' Plugin that can be found here.

But when I use that Plugin, and then click on the 'Replace File' button I get the following error message...
Quote
Sorry, you can't access this file directly, parameter 'name' is required...



So, I am asking for some help here.
Are there any modifications that need to be made to basic CPG code to convert it to MX-CPG that I have missed?
Or, more to the point, can someone get this plugin working in MX-CPG for me?

Cheesy

Thanks in advance!
Logged
Andi
VIP
***
Gender: Male
Posts: 85


Join the Future


WWW
« Reply #6 on: February 27, 2006, 09:54:40 am »

Hello Beyond_Doubt,

I answered you in pragmaMx the forum and the solution described.
http://www.pragmamx.org/forum-topic-15705.0.html

At Nibbler: you should also regard the solution, only few things are to be considered, that Plugins also runs in pragmaMx.
Logged

hope, I could help you... Smiley
Beyond_Doubt
Coppermine newbie

Posts: 18


« Reply #7 on: February 27, 2006, 01:14:44 pm »

Thank You to Nibbler for the very usefull plugin, and Thank You to Andi for helping me to use it!

Great Work Fellas. Smiley
Logged
Andi
VIP
***
Gender: Male
Posts: 85


Join the Future


WWW
« Reply #8 on: March 01, 2006, 09:00:24 am »

Hi Smiley

A small problem still exists with the Plugin.

If the option, to read the EXIF-data is switched on, these informations are not updated when we replace the picture.
I extended the Plugin as follows.

find this line:
Code:
cpg_db_query("UPDATE {$CONFIG['TABLE_PICTURES']} SET filesize = '$image_filesize', total_filesize = '$total_filesize', pwidth = '$width', pheight = '$height' WHERE pid = '$pid' LIMIT 1");

add after:
Code:
if ($CONFIG['read_exif_data']) {
    include("includes/exif_php.inc.php");
    exif_parse_file($image);
}

@ Beyond_Doubt
the updated pragmaMx file is available in the thread...
Logged

hope, I could help you... Smiley
Paver
Dev Team member
****
Gender: Male
United States United States

Posts: 1606


Paul Van Rompay


« Reply #9 on: March 31, 2006, 05:34:03 pm »

I'm not sure if this is a typo or a renamed include directory for PragmaMX, but in the core Coppermine, the include line in your mod should be the following (no 's' in the directory name):
Code:
include("include/exif_php.inc.php");
Logged
Visiluna
Coppermine newbie

Posts: 2


« Reply #10 on: May 04, 2006, 10:33:31 pm »

It appears that when you upload a replacement file, the new file takes on the filename of the original file. Would it be possible for the record to reflect the filename of the newly uploaded replacement file instead?

Thanks,
PJ
Logged
Paver
Dev Team member
****
Gender: Male
United States United States

Posts: 1606


Paul Van Rompay


« Reply #11 on: May 05, 2006, 12:00:08 am »

So you want the new file to be placed in the same folder as the old file but have it retain its filename?  (with the old file being deleted of course)

If so, try out the attached new plugin version.  I incorporated all the mods in this thread to this point (Nibbler's chmod, Andi's EXIF), then added in a configuration option to set whether you want the replaced file to have the original filename or keep its own.  The option is set in codebase.php.  You must manually change the option in the file; there is *no* web-based admin panel.  Look for the CONFIGURATION OPTIONS block and change the option to true or false, depending upon what you want.

* cpg1.4_plugin_file_replacer_1.1.zip (2.79 KB - downloaded 531 times.)
« Last Edit: May 05, 2006, 12:47:59 am by Paver » Logged
Visiluna
Coppermine newbie

Posts: 2


« Reply #12 on: May 05, 2006, 04:30:28 pm »

Thank you, thank you, thank you.

Did I mention that you guys are awesome?

Thank you again,
PJ
Logged
Eugene Merzlyakov
Coppermine newbie

Posts: 1


« Reply #13 on: May 14, 2006, 06:21:56 pm »

I've install this plug-in, below pict appeared button "replace file", but if i'm click on it - doesnt changed!
What i'm doing wrong?
Logged
Paver
Dev Team member
****
Gender: Male
United States United States

Posts: 1606


Paul Van Rompay


« Reply #14 on: May 14, 2006, 09:11:07 pm »

When you click on the "Replace File" button, it should show a new page with a single box labelled "Upload Replacement File" and a "Browse" button to select the file.

If you don't see this, you should start a new thread on the main Plugins board for support with this plugin.  Support is not available on this thread.
Logged
midnightshowx0
Coppermine newbie

Gender: Female
Posts: 10


WWW
« Reply #15 on: May 25, 2006, 05:13:11 pm »

im a little confused here, where do i put this at??
Logged
Paver
Dev Team member
****
Gender: Male
United States United States

Posts: 1606


Paul Van Rompay


« Reply #16 on: May 25, 2006, 05:20:55 pm »

http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#plugin
Logged
Eddy Newell
Coppermine newbie

Posts: 4


WWW
« Reply #17 on: September 02, 2006, 09:24:26 am »

Thanks, guys for a terrific plugin, this is just what I needed. This should be part of the core!
Logged

Eddy|eddynewell.com
Coppermine 1.4.9 bridged with SMF 1.1RC3
Bazzah
Coppermine novice
*
Posts: 25


« Reply #18 on: November 18, 2006, 10:21:10 am »

Great plug in - just what I wanted.

However, I am using this with 'Permanant watermark with undo possibility (GD2+IM working!) + better admin tools' mod. If you use this replace file mod, it does not redraw the watermark. Is this something I have done wrong, or is there possibly a fix for it?
Logged
wirewolf
Contributor
***
Gender: Male
Posts: 35


WWW
« Reply #19 on: December 01, 2006, 01:58:46 am »

Paver and all, great plugin. Very handy. I was playing around with the codebase file and added this bit of user friendliness (for those with short term memory). See the screenshot.
Near the end of codebase.php
Code:
echo <<< EOT
<tr>
<td class="tableb" valign="top">
Browse:
</td>
<td class="tableb" valign="top">
<input type="file" name="fileupload" size="40" class="listbox" />
</td>
</tr>
<tr>
<td align="center" colspan="2" class="tablef">
<input type="submit" name="commit" class="button" value="Upload"/>
</td>
</tr>

EOT;
Replaced with:
Code:
echo <<< EOT
<tr>
    <td class="tableb" valign="top">
      <input type="file" name="fileupload" size="70" class="listbox" /><br /><br />
      <input type="submit" name="commit" class="button" value="Upload" /><br /><br />File you wish to replace - $row[filename]</td>
    <td class="tableb" valign="top">
    <img src="albums/$row[filepath]thumb_$row[filename]" class="image" border="0" title="$row[filename]" alt="$row[filename]" /></a>
    </td>
</tr>
EOT;

wirewolf


* file_replacer.GIF (23.39 KB, 503x133 - viewed 1044 times.)
Logged

Pages: [1] 2   Go Up
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC
Page created in 0.078 seconds with 19 queries.