src/mako/pixl/Image.php
public function save($file = null, $quality = 95): void
	{
		$file = $file ?? $this->image;

		// Mage sure that the file or directory is writable

		if(file_exists($file))
		{
			if(!is_writable($file))
			{
				throw new RuntimeException(vsprintf('The file [ %s ] isn\'t writable.', [$file]));
			}
		}
		else
		{
			$pathInfo = pathinfo($file);

			if(!is_writable($pathInfo['dirname']))
			{
				throw new RuntimeException(vsprintf('The directory [ %s ] isn\'t writable.', [$pathInfo['dirname']]));
			}
		}

		// Save the image

		$this->processor->save($file, $this->normalizeImageQuality($quality));
	}
public function save($file = null, $quality = 95): void
	{
		$file = $file ?? $this->image;

		// Mage sure that the file or directory is writable

		if(file_exists($file))
		{
			if(!is_writable($file))
			{
				throw new RuntimeException(vsprintf('The file [ %s ] isn\'t writable.', [$file]));
			}
		}
		else
		{
			$pathInfo = pathinfo($file);

			if(!is_writable($pathInfo['dirname']))
			{
				throw new RuntimeException(vsprintf('The directory [ %s ] isn\'t writable.', [$pathInfo['dirname']]));
			}
		}

		// Save the image

		$this->processor->save($file, $this->normalizeImageQuality($quality));
	}
public function save ( $ file = null , $ quality = 95 ) : void { $ file = $ file ?? $ this -> image ; // Mage sure that the file or directory is writable if ( file_exists ( $ file ) ) { if ( ! is_writable ( $ file ) ) { throw new RuntimeException ( vsprintf ( 'The file [ %s ] isn\'t writable.' , [ $ file ] ) ) ; } } else { $ pathInfo = pathinfo ( $ file ) ; if ( ! is_writable ( $ pathInfo [ 'dirname' ] ) ) { throw new RuntimeException ( vsprintf ( 'The directory [ %s ] isn\'t writable.' , [ $ pathInfo [ 'dirname' ] ] ) ) ; } } // Save the image $ this -> processor -> save ( $ file , $ this -> normalizeImageQuality ( $ quality ) ) ; }
Saves image to file.

@param  string            $file    Path to the image file
@param  int               $quality Image quality 1-100
@throws \RuntimeException
Saves image to file .