Ignore:
Timestamp:
Jul 7, 2006 10:53:09 PM (18 years ago)
Author:
scdev
Message:

Q - increased some LOG_DEBUG messages to LOG_INFO so we can run with debugging off and still get the important ones.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/ImageThumb.inc.php

    r199 r201  
    367367                $file_size = filesize($dest_file);
    368368                if (false !== $file_size && $file_size < $spec['keep_filesize']) {
    369                     $app->logMsg(sprintf('Skipping thumbnail %s. File already exists and file size is less than %s bytes.', $spec['dest_dir'] . '/' . $file_name, $spec['keep_filesize']), LOG_DEBUG, __FILE__, __LINE__);
     369                    $app->logMsg(sprintf('Skipping thumbnail %s. File already exists and file size is less than %s bytes.', $spec['dest_dir'] . '/' . $file_name, $spec['keep_filesize']), LOG_INFO, __FILE__, __LINE__);
    370370                    continue;
    371371                }
     
    376376            if ($image_size['0'] <= $spec['width'] && $image_size['1'] <= $spec['height'] && !$spec['allow_upscaling']) {
    377377                $spec['scaling_type'] = IMAGETHUMB_NO_SCALE;
    378                 $app->logMsg(sprintf('Image %s smaller than specified %s thumbnail size. Keeping original size.', $file_name, basename($spec['dest_dir'])), LOG_DEBUG, __FILE__, __LINE__);
     378                $app->logMsg(sprintf('Image %s smaller than specified %s thumbnail size. Keeping original size.', $file_name, basename($spec['dest_dir'])), LOG_INFO, __FILE__, __LINE__);
    379379            }
    380380
     
    382382            if (IMAGETHUMB_METHOD_NETPBM === $this->getParam('resize_method') && file_exists($this->getParam('anytopnm_binary')) && file_exists($this->getParam('pnmscale_binary')) && file_exists($this->getParam('cjpeg_binary'))) {
    383383                // Resize using Netpbm binaries.
    384                 // $app->logMsg(sprintf('Resizing with Netpbm: %s', $source_file), LOG_DEBUG, __FILE__, __LINE__);
     384                $app->logMsg(sprintf('Resizing with Netpbm: %s', $source_file), LOG_DEBUG, __FILE__, __LINE__);
    385385                $return_val += $this->_resizeWithNetpbm($source_file, $dest_file, $spec);
    386386            } else if (IMAGETHUMB_METHOD_GD === $this->getParam('resize_method') && extension_loaded('gd')) {
    387387                // Resize with GD.
    388                 // $app->logMsg(sprintf('Resizing with GD: %s', $source_file), LOG_DEBUG, __FILE__, __LINE__);
     388                $app->logMsg(sprintf('Resizing with GD: %s', $source_file), LOG_DEBUG, __FILE__, __LINE__);
    389389                $return_val += $this->_resizeWithGD($source_file, $dest_file, $spec);
    390390            } else {
     
    637637            }
    638638        }
    639         $app->logMsg(sprintf('THumbnails successfully deleted for file: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);
     639        $app->logMsg(sprintf('THumbnails successfully deleted for file: %s', $file_name), LOG_INFO, __FILE__, __LINE__);
    640640        return 0 === $return_val;
    641641    }
     
    658658        }
    659659
     660        // Ensure we have a source.
     661        if ('' == $file_name) {
     662            $app->logMsg(sprintf('Cannot delete, filename empty.'), LOG_WARNING, __FILE__, __LINE__);
     663            return false;
     664        }
     665
    660666        $source_file = realpath(sprintf('%s/%s', $this->getParam('source_dir'), $file_name));
    661         if (!unlink($source_file)) {
     667        if (is_file($source_file) && unlink($source_file)) {
     668            $app->logMsg(sprintf('Original file successfully deleted: %s', $file_name), LOG_INFO, __FILE__, __LINE__);
     669            return true;
     670        } else {
    662671            $app->logMsg(sprintf('Delete original failed: %s', $source_file), LOG_WARNING, __FILE__, __LINE__);
    663672            return false;
    664673        }
    665         $app->logMsg(sprintf('Original file successfully deleted: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);
    666         return true;
    667674    }
    668675
Note: See TracChangeset for help on using the changeset viewer.