plugins/gallery/upload.php
changeset 17 ecb96b051d08
parent 12 3893b99cd443
child 32 9803dde5df5f
equal deleted inserted replaced
16:36dd990c0c25 17:ecb96b051d08
   831             // Create scaled images
   831             // Create scaled images
   832             //
   832             //
   833             
   833             
   834             // Create thumbnail image
   834             // Create thumbnail image
   835             $thumb_filename = ENANO_ROOT . '/cache/' . $stored_name . '-thumb.jpg';
   835             $thumb_filename = ENANO_ROOT . '/cache/' . $stored_name . '-thumb.jpg';
   836             if ( !unlink($thumb_filename) )
   836             if ( file_exists($thumb_filename) )
   837             {
   837             {
   838               $errors[] = "Could not delete $thumb_filename";
   838               if ( !unlink($thumb_filename) )
   839               break 2;
   839               {
       
   840                 $errors[] = "Could not delete $thumb_filename";
       
   841                 break 2;
       
   842               }
   840             }
   843             }
   841             
   844             
   842             if ( !scale_image($store, $thumb_filename, 80, 80) )
   845             if ( !scale_image($store, $thumb_filename, 80, 80) )
   843             {
   846             {
   844               $errors[] = 'Couldn\'t scale image '.$i.': ImageMagick failed us';
   847               $errors[] = 'Couldn\'t scale image '.$i.': ImageMagick failed us';
   845               break 2;
   848               break 2;
   846             }
   849             }
   847             
   850             
   848             // Create preview image
   851             // Create preview image
   849             $preview_filename = ENANO_ROOT . '/cache/' . $stored_name . '-preview.jpg';
   852             $preview_filename = ENANO_ROOT . '/cache/' . $stored_name . '-preview.jpg';
   850             if ( !unlink($preview_filename) )
   853             if ( file_exists($preview_filename) )
   851             {
   854             {
   852               $errors[] = "Could not delete $preview_filename";
   855               if ( !unlink($preview_filename) )
   853               break 2;
   856               {
       
   857                 $errors[] = "Could not delete $preview_filename";
       
   858                 break 2;
       
   859               }
   854             }
   860             }
   855             
   861             
   856             if ( !scale_image($store, $preview_filename, 640, 640) )
   862             if ( !scale_image($store, $preview_filename, 640, 640) )
   857             {
   863             {
   858               $errors[] = 'Couldn\'t scale image '.$i.': ImageMagick failed us';
   864               $errors[] = 'Couldn\'t scale image '.$i.': ImageMagick failed us';