Changeset 201 for trunk/lib/ImageThumb.inc.php
- Timestamp:
- Jul 7, 2006 10:53:09 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/ImageThumb.inc.php
r199 r201 367 367 $file_size = filesize($dest_file); 368 368 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__); 370 370 continue; 371 371 } … … 376 376 if ($image_size['0'] <= $spec['width'] && $image_size['1'] <= $spec['height'] && !$spec['allow_upscaling']) { 377 377 $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__); 379 379 } 380 380 … … 382 382 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'))) { 383 383 // 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__); 385 385 $return_val += $this->_resizeWithNetpbm($source_file, $dest_file, $spec); 386 386 } else if (IMAGETHUMB_METHOD_GD === $this->getParam('resize_method') && extension_loaded('gd')) { 387 387 // 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__); 389 389 $return_val += $this->_resizeWithGD($source_file, $dest_file, $spec); 390 390 } else { … … 637 637 } 638 638 } 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__); 640 640 return 0 === $return_val; 641 641 } … … 658 658 } 659 659 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 660 666 $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 { 662 671 $app->logMsg(sprintf('Delete original failed: %s', $source_file), LOG_WARNING, __FILE__, __LINE__); 663 672 return false; 664 673 } 665 $app->logMsg(sprintf('Original file successfully deleted: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__);666 return true;667 674 } 668 675
Note: See TracChangeset
for help on using the changeset viewer.