Changeset 199 for trunk/lib/ImageThumb.inc.php
- Timestamp:
- Jul 6, 2006 3:31:38 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/ImageThumb.inc.php
r154 r199 36 36 'dest_dir_perms' => 0700, 37 37 38 // Require file to have one of the following file name exten tions.38 // Require file to have one of the following file name extensions. 39 39 'valid_file_extensions' => array('jpg', 'jpeg', 'gif', 'png'), 40 40 … … 61 61 62 62 // Destination file types. ('jpg', 'png', 'gif', 'wbmp') 63 'dest_file_exten tion' => 'jpg',63 'dest_file_extension' => 'jpg', 64 64 65 65 // Type of scaling to perform, and sizes used to calculate max dimentions. … … 174 174 $app->logMsg(sprintf('IMG_JPG is not supported by this version of PHP GD.', null), LOG_ERR, __FILE__, __LINE__); 175 175 } 176 $spec['dest_file_exten tion'] = 'jpg';176 $spec['dest_file_extension'] = 'jpg'; 177 177 break; 178 178 case IMG_PNG : … … 180 180 $app->logMsg(sprintf('IMG_PNG is not supported by this version of PHP GD.', null), LOG_ERR, __FILE__, __LINE__); 181 181 } 182 $spec['dest_file_exten tion'] = 'png';182 $spec['dest_file_extension'] = 'png'; 183 183 break; 184 184 case IMG_GIF : … … 186 186 $app->logMsg(sprintf('IMG_GIF is not supported by this version of PHP GD.', null), LOG_ERR, __FILE__, __LINE__); 187 187 } 188 $spec['dest_file_exten tion'] = 'gif';188 $spec['dest_file_extension'] = 'gif'; 189 189 break; 190 190 case IMG_WBMP : … … 192 192 $app->logMsg(sprintf('IMG_WBMP is not supported by this version of PHP GD.', null), LOG_ERR, __FILE__, __LINE__); 193 193 } 194 $spec['dest_file_exten tion'] = 'wbmp';194 $spec['dest_file_extension'] = 'wbmp'; 195 195 break; 196 196 default : … … 269 269 * 270 270 * @access public 271 * @param string $file_name Name of file with exten tion.271 * @param string $file_name Name of file with extension. 272 272 * @param array $runtime_specs Array of specifications that will override all configured specifications. 273 273 * @return bool true on success, false on failure. … … 298 298 // Confirm source image exists. 299 299 if (!file_exists($source_file)) { 300 $this->_raiseMsg(sprintf(_("Image resizing failed: source image %swas not found."), $file_name), MSG_ERR, __FILE__, __LINE__);300 $this->_raiseMsg(sprintf(_("Image resizing failed: source image <em>%s</em> was not found."), $file_name), MSG_ERR, __FILE__, __LINE__); 301 301 $app->logMsg(sprintf('Source image not found: %s', $source_file), LOG_WARNING, __FILE__, __LINE__); 302 302 return false; … … 305 305 // Confirm source image is readable. 306 306 if (!is_readable($source_file)) { 307 $this->_raiseMsg(sprintf(_("Image resizing failed: source image %sis not readable."), $file_name), MSG_ERR, __FILE__, __LINE__);307 $this->_raiseMsg(sprintf(_("Image resizing failed: source image <em>%s</em> is not readable."), $file_name), MSG_ERR, __FILE__, __LINE__); 308 308 $app->logMsg(sprintf('Source image not readable: %s', $source_file), LOG_WARNING, __FILE__, __LINE__); 309 309 return false; … … 312 312 // Confirm source image contains data. 313 313 if (filesize($source_file) <= 0) { 314 $this->_raiseMsg(sprintf(_("Image resizing failed: source image %sis zero bytes."), $file_name), MSG_ERR, __FILE__, __LINE__);314 $this->_raiseMsg(sprintf(_("Image resizing failed: source image <em>%s</em> is zero bytes."), $file_name), MSG_ERR, __FILE__, __LINE__); 315 315 $app->logMsg(sprintf('Source image is zero bytes: %s', $source_file), LOG_WARNING, __FILE__, __LINE__); 316 316 return false; … … 319 319 // Confirm source image has a valid file extension. 320 320 if (!$this->_validFileExtension($file_name)) { 321 $this->_raiseMsg(sprintf(_("Image resizing failed: source image %snot a valid type. It must have one of the following file name extensions: %s"), $file_name, join(', ', $this->getParam('valid_file_extensions'))), MSG_ERR, __FILE__, __LINE__);321 $this->_raiseMsg(sprintf(_("Image resizing failed: source image <em>%s</em> not a valid type. It must have one of the following file name extensions: %s"), $file_name, join(', ', $this->getParam('valid_file_extensions'))), MSG_ERR, __FILE__, __LINE__); 322 322 $app->logMsg(sprintf('Image resizing failed: source image not of valid type: %s', $source_file), LOG_WARNING, __FILE__, __LINE__); 323 323 return false; … … 344 344 } 345 345 346 // Destination filename uses the exten tion defined by dest_file_extention.346 // Destination filename uses the extension defined by dest_file_extension. 347 347 if ('/' == $spec['dest_dir']{0}) { 348 348 // Absolute path. 349 $dest_file = sprintf('%s/%s.%s', $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_exten tion']);349 $dest_file = sprintf('%s/%s.%s', $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_extension']); 350 350 } else { 351 351 // Relative path. 352 $dest_file = sprintf('%s/%s/%s.%s', $this->getParam('source_dir'), $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_exten tion']);352 $dest_file = sprintf('%s/%s/%s.%s', $this->getParam('source_dir'), $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_extension']); 353 353 } 354 354 … … 440 440 441 441 // Format the command that creates the thumbnail. 442 $command = sprintf('%s %s | %s %s | %s %s > %s /%s',442 $command = sprintf('%s %s | %s %s | %s %s > %s', 443 443 escapeshellcmd($this->getParam('anytopnm_binary')), 444 444 escapeshellcmd($source_file), … … 447 447 escapeshellcmd($this->getParam('cjpeg_binary')), 448 448 escapeshellcmd($cjpeg_args), 449 escapeshellcmd($dest_file), 450 escapeshellcmd($file_name) 449 escapeshellcmd($dest_file) 451 450 ); 452 451 $app->logMsg(sprintf('ImageThumb Netpbm command: %s', $command), LOG_DEBUG, __FILE__, __LINE__); … … 609 608 * 610 609 * @access public 611 * @param string $file_name The file name to delete, with exten tion.610 * @param string $file_name The file name to delete, with extension. 612 611 * @return bool true on success, false on failure. 613 612 */ … … 626 625 if ('/' == $spec['dest_dir']{0}) { 627 626 // Absolute path. 628 $dest_file = realpath(sprintf('%s/%s.%s', $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_exten tion']));627 $dest_file = realpath(sprintf('%s/%s.%s', $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_extension'])); 629 628 } else { 630 629 // Relative path. 631 $dest_file = realpath(sprintf('%s/%s/%s.%s', $this->getParam('source_dir'), $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_exten tion']));630 $dest_file = realpath(sprintf('%s/%s/%s.%s', $this->getParam('source_dir'), $spec['dest_dir'], substr($file_name, 0, strrpos($file_name, '.')), $spec['dest_file_extension'])); 632 631 } 633 632 if (file_exists($dest_file)) { … … 638 637 } 639 638 } 640 $ this->_raiseMsg(sprintf(_("The thumbnails for file %s have been deleted."), $file_name), MSG_SUCCESS, __FILE__, __LINE__);639 $app->logMsg(sprintf('THumbnails successfully deleted for file: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__); 641 640 return 0 === $return_val; 642 641 } … … 646 645 * 647 646 * @access public 648 * @param string $file_name The file name to delete, with exten tion.647 * @param string $file_name The file name to delete, with extension. 649 648 * @return bool true on success, false on failure. 650 649 */ … … 664 663 return false; 665 664 } 666 $ this->_raiseMsg(sprintf(_("The original file %s has been deleted."), $file_name), MSG_SUCCESS, __FILE__, __LINE__);665 $app->logMsg(sprintf('Original file successfully deleted: %s', $file_name), LOG_DEBUG, __FILE__, __LINE__); 667 666 return true; 668 667 } … … 672 671 * 673 672 * @access public 674 * @param string $file_name The file name to test, with exten tion.673 * @param string $file_name The file name to test, with extension. 675 674 * @return bool true on success, false on failure. 676 675 */ … … 690 689 691 690 /** 692 * Tests if exten tion of $file_name is in the array valid_file_extensions.691 * Tests if extension of $file_name is in the array valid_file_extensions. 693 692 * 694 693 * @access public
Note: See TracChangeset
for help on using the changeset viewer.