Permalink
Browse files

fixes to compressor

  • Loading branch information...
kaviththiranga committed Jul 29, 2012
1 parent 7a0b369 commit 69ddffef5577ed5b4eadf8ce7eacdcbffce1e82c
Showing with 7 additions and 1 deletion.
  1. +7 −1 libraries/joomla/media/compressor.php
@@ -227,7 +227,7 @@ public static function compressString( $uncompressed, $options)
* Compress a CSS/JS file with given options
*
* @param string $sourcefile The full file path of the source file.
- * @param array $options An asssociative array with options. Eg: force overwirte, prefix for minified files
+ * @param array $options An asssociative array with options. Eg: type, force overwirte, prefix for minified files
* @param string $destination The full file path of the destination file. If left empty the compressed file will be returned as string
*
* @return boolean false on failure.
@@ -236,6 +236,12 @@ public static function compressString( $uncompressed, $options)
*/
public static function compressFile( $sourcefile, $options = array(), $destination = null )
{
+ $options['type'] = strtolower(JFile::getExt($sourcefile));
+
+ if (!self::isSupported($sourcefile))
+ {
+ throw new RuntimeException(JText::sprintf('JMEDIA_ERROR_FILE_TYPE_NOT_SUPPORTED'));
+ }
$compressor = self::getInstance($options);
$uncompressed = JFile::read($sourcefile);

0 comments on commit 69ddffe

Please sign in to comment.