Advanced search  

News:

cpg1.5.48 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.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Delete the picture after upload and keep the thumbnails !!  (Read 2625 times)

0 Members and 1 Guest are viewing this topic.

foxus777

  • Coppermine newbie
  • Offline Offline
  • Posts: 5

hello

I would delete the picture after the upload, and keep the thumbnail created by coppermine, automaticaly, it's easy you think ?

thanks you :)
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Delete the picture after upload and keep the thumbnails !!
« Reply #1 on: May 22, 2006, 05:45:46 pm »

you'll have to modify include/picmgmnt.inc.php
but just deleting the pic will mean you've a lot of broken links / img tags

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Delete the picture after upload and keep the thumbnails !!
« Reply #2 on: May 22, 2006, 07:25:32 pm »

a common misunderstanding: coppermine doesn't store the pics in the database, but only that path to the pics. Deleting the pics means (as Stramm suggested) rendering the link from thumbnail to intermediate/full-sized pic broken.
Logged

foxus777

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: Delete the picture after upload and keep the thumbnails !!
« Reply #3 on: May 22, 2006, 10:51:51 pm »

okay, i know the effet of this operation thanks :)

in picmgmnt.inc.php, i must modifie what exactly ?

thanks :)
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: Delete the picture after upload and keep the thumbnails !!
« Reply #4 on: May 24, 2006, 11:26:49 am »

untested and with no guarantee...
the most easiest solution is to let coppemine create the images and after it has done the necessary sql queries, deleteing the images
add
Code: [Select]
        @unlink($normal);
        @unlink($image);

right after
Code: [Select]
    $query = "INSERT INTO {$CONFIG['TABLE_PICTURES']} (aid, filepath, filename, filesize, total_filesize, pwidth, pheight, ctime, owner_id, owner_name, title, caption, keywords, approved, user1, user2, user3, user4, pic_raw_ip, pic_hdr_ip, position) VALUES ('{$CURRENT_PIC_DATA['aid']}', '" . addslashes($CURRENT_PIC_DATA['filepath']) . "', '" . addslashes($CURRENT_PIC_DATA['filename']) . "', '{$CURRENT_PIC_DATA['filesize']}', '{$CURRENT_PIC_DATA['total_filesize']}', '{$CURRENT_PIC_DATA['pwidth']}', '{$CURRENT_PIC_DATA['pheight']}', '" . time() . "', '{$CURRENT_PIC_DATA['owner_id']}', '{$CURRENT_PIC_DATA['owner_name']}','{$CURRENT_PIC_DATA['title']}', '{$CURRENT_PIC_DATA['caption']}', '{$CURRENT_PIC_DATA['keywords']}', '{$CURRENT_PIC_DATA['approved']}', '{$CURRENT_PIC_DATA['user1']}', '{$CURRENT_PIC_DATA['user2']}', '{$CURRENT_PIC_DATA['user3']}', '{$CURRENT_PIC_DATA['user4']}', '{$CURRENT_PIC_DATA['pic_raw_ip']}', '{$CURRENT_PIC_DATA['pic_hdr_ip']}', '{$CURRENT_PIC_DATA['position']}')";
    $result = cpg_db_query($query);

Pages: [1]   Go Up
 

Page created in 0.019 seconds with 15 queries.