Advanced search  

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

Pages: [1] 2 3   Go Down

Author Topic: File replacement plugin  (Read 105246 times)

0 Members and 1 Guest are viewing this topic.

Nibbler

  • Guest
File replacement plugin
« on: August 26, 2005, 04: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.
Logged

flashi

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 4
    • My photos
No access after replacing file with plugin
« Reply #1 on: February 11, 2006, 04:50:50 pm »

Hi all  :)

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   :o

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"  :(

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

  • Guest
Re: File replacement plugin
« Reply #2 on: February 11, 2006, 05:03:19 pm »

Look in the plugin's codebase.php for

Code: [Select]
move_uploaded_file($_FILES['fileupload']['tmp_name'], $image);
and add after it

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

flashi

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 4
    • My photos
Re: File replacement plugin
« Reply #3 on: February 11, 2006, 05:09:55 pm »

Wow, that was a fast solution  :o

I thank you very much, everything works fine now  ;D
Logged

LilAngel

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 39
Re: File replacement plugin
« Reply #4 on: February 19, 2006, 03: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
  • Offline Offline
  • Posts: 18
Re: File replacement plugin
« Reply #5 on: February 27, 2006, 12:55:55 am »

This is a plugin that fits my needs 100% :)

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. :)

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: [Select]
require ('plugins/control_fullsize/include/init.inc.php');to
Code: [Select]
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?

:D

Thanks in advance!
Logged

Andi

  • VIP
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 85
  • Join the Future
    • www.pragmamx.org
Re: File replacement plugin
« Reply #6 on: February 27, 2006, 10: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... :)

Beyond_Doubt

  • Coppermine newbie
  • Offline Offline
  • Posts: 18
Re: File replacement plugin
« Reply #7 on: February 27, 2006, 02: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. :)
Logged

Andi

  • VIP
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 85
  • Join the Future
    • www.pragmamx.org
Re: File replacement plugin
« Reply #8 on: March 01, 2006, 10:00:24 am »

Hi :)

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: [Select]
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: [Select]
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... :)

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: File replacement plugin
« Reply #9 on: March 31, 2006, 06: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: [Select]
include("include/exif_php.inc.php");
Logged

Visiluna

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: File replacement plugin
« Reply #10 on: May 04, 2006, 11: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
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: File replacement plugin
« Reply #11 on: May 05, 2006, 01: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.
« Last Edit: May 05, 2006, 01:47:59 am by Paver »
Logged

Visiluna

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: File replacement plugin
« Reply #12 on: May 05, 2006, 05: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
  • Offline Offline
  • Posts: 1
Re: File replacement plugin
« Reply #13 on: May 14, 2006, 07: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
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: File replacement plugin
« Reply #14 on: May 14, 2006, 10: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
  • Offline Offline
  • Gender: Female
  • Posts: 10
    • Kevin Jonas Online
Re: File replacement plugin
« Reply #15 on: May 25, 2006, 06:13:11 pm »

im a little confused here, where do i put this at??
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Logged

Eddy Newell

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
    • eddynewell.com
Re: File replacement plugin
« Reply #17 on: September 02, 2006, 10: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
  • *
  • Offline Offline
  • Posts: 25
Re: File replacement plugin
« Reply #18 on: November 18, 2006, 11: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
  • Coppermine novice
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Ship Modeling Forum
Re: File replacement plugin
« Reply #19 on: December 01, 2006, 02: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: [Select]
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: [Select]
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
Pages: [1] 2 3   Go Up
 

Page created in 0.029 seconds with 20 queries.