Jump to content


Photo
- - - - -

[BUG FIX] - Delete Photo from Album

siteadmin

  • Please log in to reply
No replies to this topic

#1 theone

theone

    Senior Member

  • Members
  • PipPipPipPip
  • 368 posts

Posted 23 February 2013 - 05:06 AM

If a user deletes a photo from within an existing album, the information is removed from the database but the photo remains on the server.

This can take up a lot of space and it is nearly impossible to sort through which photos are no longer needed on your server.

The following is a fix that will remove the photo from your server when a user deletes a photo from an album.

Open ../include/ajax/delete_photo.php

Find.....


$sql = "DELETE FROM photo_favorites WHERE UID = " .$uid. " AND PID = " .$pid. " LIMIT 1";
$conn->execute($sql);


Add this below....


@unlink($config['BASE_DIR']. '/media/photos/' .$pid. '.jpg');
@unlink($config['BASE_DIR']. '/media/photos/tmb/' .$pid. '.jpg');






Also tagged with one or more of these keywords: siteadmin