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]   Go Down

Author Topic: [TIP] "original" image file delete prevention  (Read 5484 times)

0 Members and 1 Guest are viewing this topic.

wooff

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
[TIP] "original" image file delete prevention
« on: May 25, 2006, 09:31:20 pm »

Hi,
I change the code to prevent deleting of "original" images files. Now, when you want to delete albums or files. It will delete only: thumbnails, reduce size, comments, (album). The original file will stay untoched.

Edit file /cpg/delete.php
Code: [Select]
$files = array($dir . $file, $dir . $CONFIG['normal_pfx'] . $file, $dir . $CONFIG['thumb_pfx'] . $file);
    foreach ($files as $currFile) {
        echo "<td class=\"tableb\" align=\"center\">";
        if (is_file($currFile)) {
            if (@unlink($currFile))
                echo $green;
            else
                echo $red;
        } else
            echo "&nbsp;";
        echo "</td>";
replace with
Code: [Select]
$files = array($dir . nodelete, $dir . $CONFIG['normal_pfx'] . $file, $dir . $CONFIG['thumb_pfx'] . $file);
    foreach ($files as $currFile) {
        echo "<td class=\"tableb\" align=\"center\">";
        if (is_file($currFile)) {
            if (@unlink($currFile))
                echo $green;
            else
                echo $red;
        } else
            if ($currFile == $dir . nodelete) {
            echo $red;
            } else
              echo "&nbsp;";
        echo "</td>";

Result will look like on the attached picture.
Base of this I found on this forum. I thought that "Nibbler" post it, but Iam not sure. Thank to him or anybody else ((-:
Have a nice day ((-:
W
Logged

cgc0202

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 199
Re: [TIP] "original" image file delete prevention
« Reply #1 on: June 07, 2006, 05:40:39 am »

I change the code to prevent deleting of "original" images files. Now, when you want to delete albums or files. It will delete only: thumbnails, reduce size, comments, (album). The original file will stay untoched. ...
W


Hi wooff,

Paver directed me to your post, based from an inquiry I had:

http://forum.coppermine-gallery.net/index.php?topic=32316.msg150195

Is there a way so that your script may be revised further so that not only is the original photo, but also the thumbnails, intermediate photos, as well as other stuff associated with the photo (comments, caption, etc.) are retained?   The only thing that must be achieved is that the photo (i.e., thumbnail) link is deleted from a specific album.

If this could be done, the revised script may be used for a number of existing features of Coppermine.  For example, allowing "users" who post in public albums to edit their posted photos, without the ability to delete the original and derivative photo itself.  It may be useful also for those who would want to allow  Moderator mod of Abbas, but not allow a Moderator to have delete permissions.

cgc0202

« Last Edit: June 07, 2006, 06:16:20 am by cgc0202 »
Logged

wooff

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: [TIP] "original" image file delete prevention
« Reply #2 on: June 07, 2006, 07:13:37 am »

hi, Iam not sure what do you want exactly.
This my very easy and small code isnt really plugin. Its just change of code whitch prevent the original file to be deleted.
I mean, prevent to be deleted by all ways. Because I removed pard of code which did it. And rerplace id with one who will show the red icon.
Thats all.
All other files are normally deleted. But Iam not sure about captions and thinks like this (strings variables). Iam not really sure where are they stored.
W
Logged

cgc0202

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 199
Re: [TIP] "original" image file delete prevention
« Reply #3 on: June 07, 2006, 07:36:13 am »

Thanks for the response.

hi, Iam not sure what do you want exactly.
This my very easy and small code isnt really plugin. Its just change of code whitch prevent the original file to be deleted.
I mean, prevent to be deleted by all ways. Because I removed pard of code which did it. And rerplace id with one who will show the red icon.
Thats all.

For starters, I wonder if the thumbnails and intermediate photos may not be deleted also.

All other files are normally deleted. But Iam not sure about captions and thinks like this (strings variables). Iam not really sure where are they stored.
W

The original and derivative photos themselves are stored normally in the Albums and its subdirectories.  As far as I know, all the rest are stored in specific tables in the database.

cgc0202
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: [TIP] "original" image file delete prevention
« Reply #4 on: June 07, 2006, 09:16:30 am »

Coppermine doesn't store files in the db, neither thumbnails nor intermediate-sized files. All those files are stored in the same folder as the original pics. Inside the db, only relative paths are being stored, that's all.
Logged

cgc0202

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 199
Re: [TIP] "original" image file delete prevention
« Reply #5 on: June 07, 2006, 09:52:07 am »

Coppermine doesn't store files in the db, neither thumbnails nor intermediate-sized files. All those files are stored in the same folder as the original pics. Inside the db, only relative paths are being stored, that's all.

You are correct Gaugau, and that is what I stated in my previous post.  The photos for example are stored usually in the "albums" directory and its subdirectories "userpics" and another for those entered by the Admin using FTP.  In my case, I opted to place them in a separate directory and subdirectories -- independent of the CPG directory because I opted for multigalleries.

I have been analysing the DB tables of CPG because there are features that I wish to understand more.  I have not analyzed it fully and extensively yet, but in a specific table, the characteristics of the individual photos (size, width, length, etc), as well as other user inputs associated with each photo, are stored in that table.  I will post a separate thread in regard this issue, about photo-related stored info -- to further clarify the implications of editing the original photos.

cgc0202
Logged
Pages: [1]   Go Up
 

Page created in 0.374 seconds with 19 queries.