plugins/gallery/upload.php
changeset 17 ecb96b051d08
parent 12 3893b99cd443
child 32 9803dde5df5f
--- a/plugins/gallery/upload.php	Thu Nov 29 22:47:20 2007 -0500
+++ b/plugins/gallery/upload.php	Wed Dec 05 16:53:26 2007 -0500
@@ -833,10 +833,13 @@
             
             // Create thumbnail image
             $thumb_filename = ENANO_ROOT . '/cache/' . $stored_name . '-thumb.jpg';
-            if ( !unlink($thumb_filename) )
+            if ( file_exists($thumb_filename) )
             {
-              $errors[] = "Could not delete $thumb_filename";
-              break 2;
+              if ( !unlink($thumb_filename) )
+              {
+                $errors[] = "Could not delete $thumb_filename";
+                break 2;
+              }
             }
             
             if ( !scale_image($store, $thumb_filename, 80, 80) )
@@ -847,10 +850,13 @@
             
             // Create preview image
             $preview_filename = ENANO_ROOT . '/cache/' . $stored_name . '-preview.jpg';
-            if ( !unlink($preview_filename) )
+            if ( file_exists($preview_filename) )
             {
-              $errors[] = "Could not delete $preview_filename";
-              break 2;
+              if ( !unlink($preview_filename) )
+              {
+                $errors[] = "Could not delete $preview_filename";
+                break 2;
+              }
             }
             
             if ( !scale_image($store, $preview_filename, 640, 640) )