protected function _createImage( MW_Media_Image_Interface $mediaFile, $type, $domain, $src, $filename )
	{
		$mimetype = $mediaFile->getMimetype();
		$config = $this->_getContext()->getConfig();

		/** controller/extjs/media/default/files/allowedtypes
		 * A list of image mime types that are allowed for uploaded image files
		 *
		 * The list of allowed image types must be explicitly configured for the
		 * uploaded image files. Trying to upload and store an image file not
		 * available in the list of allowed mime types will result in an exception.
		 *
		 * @param array List of image mime types
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */

		/** controller/extjs/media/default/preview/allowedtypes
		 * A list of image mime types that are allowed for preview image files
		 *
		 * The list of allowed image types must be explicitly configured for the
		 * preview image files. Trying to create a preview image whose mime type
		 * is not available in the list of allowed mime types will result in an
		 * exception.
		 *
		 * @param array List of image mime types
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */
		$default = array( 'image/jpeg', 'image/png', 'image/gif' );
		$allowed = $config->get( 'controller/extjs/media/default/' . $type . '/allowedtypes', $default );

		if( in_array( $mimetype, $allowed ) === false )
		{
			if( ( $defaulttype = reset( $allowed ) ) !== false ) {
				$mimetype = $defaulttype;
			} else {
				throw new Controller_ExtJS_Exception( sprintf( 'No allowed image types configured for "%1$s"', $type ) );
			}
		}


		if( ( $mediadir = $config->get( 'controller/extjs/media/default/upload/directory', null ) ) === null ) {
			throw new Controller_ExtJS_Exception( 'No media directory configured' );
		}

		$ds = DIRECTORY_SEPARATOR;
		$fileext = $this->_getFileExtension( $mimetype );
		$filepath = $mediadir . $ds . $type . $ds . $domain . $ds . $filename[0] . $ds . $filename[1];
		$dest =  $this->_getAbsoluteDirectory( $filepath ). $ds . $filename . $fileext;


		/** controller/extjs/media/default/files/maxwidth
		 * Maximum width of the uploaded images
		 *
		 * The uploaded image files are scaled down if their width exceeds the
		 * configured width of pixels. If the image width in smaller than the
		 * configured one, no scaling happens. In case of a value of null or if
		 * no configuration for that option is available, the image width isn't
		 * scaled at all.
		 *
		 * The width/height ratio of the image is always kept.
		 *
		 * @param integer|null Width in pixel or null for no scaling
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */

		/** controller/extjs/media/default/preview/maxwidth
		 * Maximum width of the preview images
		 *
		 * The preview image files are created with the configured width in
		 * pixel. If the original image width in smaller than the one configured
		 * for the preview image, the width of the original image is used. In
		 * case of a value of null or if no configuration for that option is
		 * available, the width of the preview image is the same as the width of
		 * the original image.
		 *
		 * The width/height ratio of the preview image is always the same as for
		 * the original image.
		 *
		 * @param integer|null Width in pixel or null for no scaling
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */
		$maxwidth = $config->get( 'controller/extjs/media/default/' . $type . '/maxwidth', null );

		/** controller/extjs/media/default/files/maxheight
		 * Maximum height of the uploaded images
		 *
		 * The uploaded image files are scaled down if their height exceeds the
		 * configured height of pixels. If the image height in smaller than the
		 * configured one, no scaling happens. In case of a value of null or if
		 * no configuration for that option is available, the image width isn't
		 * scaled at all.
		 *
		 * The width/height ratio of the image is always kept.
		 *
		 * @param integer|null Height in pixel or null for no scaling
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */

		/** controller/extjs/media/default/preview/maxheight
		 * Maximum height of the preview images
		 *
		 * The preview image files are created with the configured width in
		 * pixel. If the original image height in smaller than the one configured
		 * for the preview image, the height of the original image is used. In
		 * case of a value of null or if no configuration for that option is
		 * available, the height of the preview image is the same as the height
		 * of the original image.
		 *
		 * The width/height ratio of the preview image is always the same as for
		 * the original image.
		 *
		 * @param integer|null Height in pixel or null for no scaling
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */
		$maxheight = $config->get( 'controller/extjs/media/default/' . $type . '/maxheight', null );

		$mediaFile->scale( $maxwidth, $maxheight );
		$mediaFile->save( $dest, $mimetype );


		/** controller/extjs/media/default/upload/fileperms
		 * File permissions used when storing uploaded or created files
		 *
		 * The representation of the permissions is in octal notation (using 0-7)
		 * with a leading zero. The first number after the leading zero are the
		 * permissions for the web server creating the directory, the second is
		 * for the primary group of the web server and the last number represents
		 * the permissions for everyone else.
		 *
		 * You should use 0775 or 0755 for the permissions as the web server needs
		 * to manage the files and they are publically available, so it's not
		 * necessary to limit read access for everyone else. The group permissions
		 * are important if you plan to upload files directly via FTP or by other
		 * means because then the web server needs to be able to read and manage
		 * those files. In this case use 0775 as permissions, otherwise you can
		 * limit them to 0755.
		 *
		 * A more detailed description of the meaning of the Unix file permission
		 * bits can be found in the Wikipedia article about
		 * {@link https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation file system permissions}
		 *
		 * @param integer Octal Unix permission representation
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */
		$perms = $config->get( 'controller/extjs/media/default/upload/fileperms', 0664 );

		if( chmod( $dest, $perms ) === false )
		{
			$msg = sprintf( 'Changing file permissions for "%1$s" to "%2$o" failed', $dest, $perms );
			$this->_getContext()->getLogger()->log( $msg, MW_Logger_Abstract::WARN );
		}

		return "${mediadir}/${type}/${domain}/${filename[0]}/${filename[1]}/${filename}${fileext}";
	}
protected function _createImage( MW_Media_Image_Interface $mediaFile, $type, $domain, $src, $filename )
	{
		$mimetype = $mediaFile->getMimetype();
		$config = $this->_getContext()->getConfig();

		/** controller/extjs/media/default/files/allowedtypes
		 * A list of image mime types that are allowed for uploaded image files
		 *
		 * The list of allowed image types must be explicitly configured for the
		 * uploaded image files. Trying to upload and store an image file not
		 * available in the list of allowed mime types will result in an exception.
		 *
		 * @param array List of image mime types
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */

		/** controller/extjs/media/default/preview/allowedtypes
		 * A list of image mime types that are allowed for preview image files
		 *
		 * The list of allowed image types must be explicitly configured for the
		 * preview image files. Trying to create a preview image whose mime type
		 * is not available in the list of allowed mime types will result in an
		 * exception.
		 *
		 * @param array List of image mime types
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */
		$default = array( 'image/jpeg', 'image/png', 'image/gif' );
		$allowed = $config->get( 'controller/extjs/media/default/' . $type . '/allowedtypes', $default );

		if( in_array( $mimetype, $allowed ) === false )
		{
			if( ( $defaulttype = reset( $allowed ) ) !== false ) {
				$mimetype = $defaulttype;
			} else {
				throw new Controller_ExtJS_Exception( sprintf( 'No allowed image types configured for "%1$s"', $type ) );
			}
		}


		if( ( $mediadir = $config->get( 'controller/extjs/media/default/upload/directory', null ) ) === null ) {
			throw new Controller_ExtJS_Exception( 'No media directory configured' );
		}

		$ds = DIRECTORY_SEPARATOR;
		$fileext = $this->_getFileExtension( $mimetype );
		$filepath = $mediadir . $ds . $type . $ds . $domain . $ds . $filename[0] . $ds . $filename[1];
		$dest =  $this->_getAbsoluteDirectory( $filepath ). $ds . $filename . $fileext;


		/** controller/extjs/media/default/files/maxwidth
		 * Maximum width of the uploaded images
		 *
		 * The uploaded image files are scaled down if their width exceeds the
		 * configured width of pixels. If the image width in smaller than the
		 * configured one, no scaling happens. In case of a value of null or if
		 * no configuration for that option is available, the image width isn't
		 * scaled at all.
		 *
		 * The width/height ratio of the image is always kept.
		 *
		 * @param integer|null Width in pixel or null for no scaling
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */

		/** controller/extjs/media/default/preview/maxwidth
		 * Maximum width of the preview images
		 *
		 * The preview image files are created with the configured width in
		 * pixel. If the original image width in smaller than the one configured
		 * for the preview image, the width of the original image is used. In
		 * case of a value of null or if no configuration for that option is
		 * available, the width of the preview image is the same as the width of
		 * the original image.
		 *
		 * The width/height ratio of the preview image is always the same as for
		 * the original image.
		 *
		 * @param integer|null Width in pixel or null for no scaling
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */
		$maxwidth = $config->get( 'controller/extjs/media/default/' . $type . '/maxwidth', null );

		/** controller/extjs/media/default/files/maxheight
		 * Maximum height of the uploaded images
		 *
		 * The uploaded image files are scaled down if their height exceeds the
		 * configured height of pixels. If the image height in smaller than the
		 * configured one, no scaling happens. In case of a value of null or if
		 * no configuration for that option is available, the image width isn't
		 * scaled at all.
		 *
		 * The width/height ratio of the image is always kept.
		 *
		 * @param integer|null Height in pixel or null for no scaling
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */

		/** controller/extjs/media/default/preview/maxheight
		 * Maximum height of the preview images
		 *
		 * The preview image files are created with the configured width in
		 * pixel. If the original image height in smaller than the one configured
		 * for the preview image, the height of the original image is used. In
		 * case of a value of null or if no configuration for that option is
		 * available, the height of the preview image is the same as the height
		 * of the original image.
		 *
		 * The width/height ratio of the preview image is always the same as for
		 * the original image.
		 *
		 * @param integer|null Height in pixel or null for no scaling
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */
		$maxheight = $config->get( 'controller/extjs/media/default/' . $type . '/maxheight', null );

		$mediaFile->scale( $maxwidth, $maxheight );
		$mediaFile->save( $dest, $mimetype );


		/** controller/extjs/media/default/upload/fileperms
		 * File permissions used when storing uploaded or created files
		 *
		 * The representation of the permissions is in octal notation (using 0-7)
		 * with a leading zero. The first number after the leading zero are the
		 * permissions for the web server creating the directory, the second is
		 * for the primary group of the web server and the last number represents
		 * the permissions for everyone else.
		 *
		 * You should use 0775 or 0755 for the permissions as the web server needs
		 * to manage the files and they are publically available, so it's not
		 * necessary to limit read access for everyone else. The group permissions
		 * are important if you plan to upload files directly via FTP or by other
		 * means because then the web server needs to be able to read and manage
		 * those files. In this case use 0775 as permissions, otherwise you can
		 * limit them to 0755.
		 *
		 * A more detailed description of the meaning of the Unix file permission
		 * bits can be found in the Wikipedia article about
		 * {@link https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation file system permissions}
		 *
		 * @param integer Octal Unix permission representation
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */
		$perms = $config->get( 'controller/extjs/media/default/upload/fileperms', 0664 );

		if( chmod( $dest, $perms ) === false )
		{
			$msg = sprintf( 'Changing file permissions for "%1$s" to "%2$o" failed', $dest, $perms );
			$this->_getContext()->getLogger()->log( $msg, MW_Logger_Abstract::WARN );
		}

		return "${mediadir}/${type}/${domain}/${filename[0]}/${filename[1]}/${filename}${fileext}";
	}
protected function _createImage ( MW_Media_Image_Interface $ mediaFile , $ type , $ domain , $ src , $ filename ) { $ mimetype = $ mediaFile -> getMimetype ( ) ; $ config = $ this -> _getContext ( ) -> getConfig ( ) ; /** controller/extjs/media/default/files/allowedtypes
		 * A list of image mime types that are allowed for uploaded image files
		 *
		 * The list of allowed image types must be explicitly configured for the
		 * uploaded image files. Trying to upload and store an image file not
		 * available in the list of allowed mime types will result in an exception.
		 *
		 * @param array List of image mime types
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */ /** controller/extjs/media/default/preview/allowedtypes
		 * A list of image mime types that are allowed for preview image files
		 *
		 * The list of allowed image types must be explicitly configured for the
		 * preview image files. Trying to create a preview image whose mime type
		 * is not available in the list of allowed mime types will result in an
		 * exception.
		 *
		 * @param array List of image mime types
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */ $ default = array ( 'image/jpeg' , 'image/png' , 'image/gif' ) ; $ allowed = $ config -> get ( 'controller/extjs/media/default/' . $ type . '/allowedtypes' , $ default ) ; if ( in_array ( $ mimetype , $ allowed ) === false ) { if ( ( $ defaulttype = reset ( $ allowed ) ) !== false ) { $ mimetype = $ defaulttype ; } else { throw new Controller_ExtJS_Exception ( sprintf ( 'No allowed image types configured for "%1$s"' , $ type ) ) ; } } if ( ( $ mediadir = $ config -> get ( 'controller/extjs/media/default/upload/directory' , null ) ) === null ) { throw new Controller_ExtJS_Exception ( 'No media directory configured' ) ; } $ ds = DIRECTORY_SEPARATOR ; $ fileext = $ this -> _getFileExtension ( $ mimetype ) ; $ filepath = $ mediadir . $ ds . $ type . $ ds . $ domain . $ ds . $ filename [ 0 ] . $ ds . $ filename [ 1 ] ; $ dest = $ this -> _getAbsoluteDirectory ( $ filepath ) . $ ds . $ filename . $ fileext ; /** controller/extjs/media/default/files/maxwidth
		 * Maximum width of the uploaded images
		 *
		 * The uploaded image files are scaled down if their width exceeds the
		 * configured width of pixels. If the image width in smaller than the
		 * configured one, no scaling happens. In case of a value of null or if
		 * no configuration for that option is available, the image width isn't
		 * scaled at all.
		 *
		 * The width/height ratio of the image is always kept.
		 *
		 * @param integer|null Width in pixel or null for no scaling
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */ /** controller/extjs/media/default/preview/maxwidth
		 * Maximum width of the preview images
		 *
		 * The preview image files are created with the configured width in
		 * pixel. If the original image width in smaller than the one configured
		 * for the preview image, the width of the original image is used. In
		 * case of a value of null or if no configuration for that option is
		 * available, the width of the preview image is the same as the width of
		 * the original image.
		 *
		 * The width/height ratio of the preview image is always the same as for
		 * the original image.
		 *
		 * @param integer|null Width in pixel or null for no scaling
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */ $ maxwidth = $ config -> get ( 'controller/extjs/media/default/' . $ type . '/maxwidth' , null ) ; /** controller/extjs/media/default/files/maxheight
		 * Maximum height of the uploaded images
		 *
		 * The uploaded image files are scaled down if their height exceeds the
		 * configured height of pixels. If the image height in smaller than the
		 * configured one, no scaling happens. In case of a value of null or if
		 * no configuration for that option is available, the image width isn't
		 * scaled at all.
		 *
		 * The width/height ratio of the image is always kept.
		 *
		 * @param integer|null Height in pixel or null for no scaling
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */ /** controller/extjs/media/default/preview/maxheight
		 * Maximum height of the preview images
		 *
		 * The preview image files are created with the configured width in
		 * pixel. If the original image height in smaller than the one configured
		 * for the preview image, the height of the original image is used. In
		 * case of a value of null or if no configuration for that option is
		 * available, the height of the preview image is the same as the height
		 * of the original image.
		 *
		 * The width/height ratio of the preview image is always the same as for
		 * the original image.
		 *
		 * @param integer|null Height in pixel or null for no scaling
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */ $ maxheight = $ config -> get ( 'controller/extjs/media/default/' . $ type . '/maxheight' , null ) ; $ mediaFile -> scale ( $ maxwidth , $ maxheight ) ; $ mediaFile -> save ( $ dest , $ mimetype ) ; /** controller/extjs/media/default/upload/fileperms
		 * File permissions used when storing uploaded or created files
		 *
		 * The representation of the permissions is in octal notation (using 0-7)
		 * with a leading zero. The first number after the leading zero are the
		 * permissions for the web server creating the directory, the second is
		 * for the primary group of the web server and the last number represents
		 * the permissions for everyone else.
		 *
		 * You should use 0775 or 0755 for the permissions as the web server needs
		 * to manage the files and they are publically available, so it's not
		 * necessary to limit read access for everyone else. The group permissions
		 * are important if you plan to upload files directly via FTP or by other
		 * means because then the web server needs to be able to read and manage
		 * those files. In this case use 0775 as permissions, otherwise you can
		 * limit them to 0755.
		 *
		 * A more detailed description of the meaning of the Unix file permission
		 * bits can be found in the Wikipedia article about
		 * {@link https://en.wikipedia.org/wiki/File_system_permissions#Numeric_notation file system permissions}
		 *
		 * @param integer Octal Unix permission representation
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */ $ perms = $ config -> get ( 'controller/extjs/media/default/upload/fileperms' , 0664 ) ; if ( chmod ( $ dest , $ perms ) === false ) { $ msg = sprintf ( 'Changing file permissions for "%1$s" to "%2$o" failed' , $ dest , $ perms ) ; $ this -> _getContext ( ) -> getLogger ( ) -> log ( $ msg , MW_Logger_Abstract :: WARN ) ; } return "${mediadir}/${type}/${domain}/${filename[0]}/${filename[1]}/${filename}${fileext}" ; }
Creates a scaled image and returns it's new file name.

@param MW_Media_Image_Interface $mediaFile Media object
@param string $type Type of the image like "preview" or "files"
@param string $domain Domain the image belongs to, e.g. "product", "attribute", etc.
@param string $src Path to original file
@param string $filename Name of the new file without file extension
@return string Relative path to the new file
@throws Controller_ExtJS_Exception If the configuration is invalid or due to insufficient permissions
Creates a scaled image and returns it s new file name .