diff options
| author | Christian Fowler <spider@viovio.com> | 2007-01-17 00:00:29 +0000 |
|---|---|---|
| committer | Christian Fowler <spider@viovio.com> | 2007-01-17 00:00:29 +0000 |
| commit | 9bb283b83218d78ece31018ab50fac9a4839b306 (patch) | |
| tree | f4c1fa6f24a824171f4a5a779ebc210dfdf68bf4 /edit_image.php | |
| parent | b2048705c8eef6b795872a5fed5e98927dae6e0f (diff) | |
| download | fisheye-9bb283b83218d78ece31018ab50fac9a4839b306.tar.gz fisheye-9bb283b83218d78ece31018ab50fac9a4839b306.tar.bz2 fisheye-9bb283b83218d78ece31018ab50fac9a4839b306.zip | |
remove original file if name changed, and original.jpg if exists
Diffstat (limited to 'edit_image.php')
| -rw-r--r-- | edit_image.php | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/edit_image.php b/edit_image.php index f28ba22..7d2aec4 100644 --- a/edit_image.php +++ b/edit_image.php @@ -1,6 +1,6 @@ <?php /** - * @version $Header: /cvsroot/bitweaver/_bit_fisheye/edit_image.php,v 1.15 2007/01/01 16:20:46 squareing Exp $ + * @version $Header: /cvsroot/bitweaver/_bit_fisheye/edit_image.php,v 1.16 2007/01/17 00:00:29 spiderr Exp $ * @package fisheye * @subpackage functions */ @@ -37,9 +37,22 @@ if( !empty($_REQUEST['saveImage']) || !empty($_REQUEST['regenerateThumbnails'] ) if (isset($_FILES['imageFile']) && is_uploaded_file($_FILES['imageFile']['tmp_name'])) { $_REQUEST['upload'] = &$_FILES['imageFile']; $_REQUEST['upload']['process_storage'] = STORAGE_IMAGE; + $replaceOriginal=$gContent->getSourceFile(); + if( file_exists( dirname( $replaceOriginal ).'/original.jpg' ) ) { + unlink( dirname( $replaceOriginal ).'/original.jpg' ); + } } + $_REQUEST['purge_from_galleries'] = TRUE; if( $gContent->store($_REQUEST) ) { + // refresh all hashes + $gContent->load(); + + // if user uploaded a file with a different name, delete the previous original file + if( $replaceOriginal != $gContent->getSourceFile() && file_exists( $replaceOriginal ) ) { + unlink( $replaceOriginal ); + } + // maybe we need to resize the original and generate thumbnails if( !empty( $_REQUEST['resize'] ) ) { $gContent->resizeOriginal( $_REQUEST['resize'] ); |
