src/Beluga/Drawing/Image/GdImage.php
public final function output( int $quality = 60, string $filename = null )
   {

      \header( 'Expires: 0' );
      \header( 'Cache-Control: private' );
      \header( 'Pragma: cache' );

      if ( empty( $filename ) )
      {
         $filename = \basename( $this->_file );
      }
      else
      {
         $filename = \basename( $filename );
      }

      if ( ! empty( $filename ) )
      {
         \header( "Content-Disposition: inline; filename=\"{$filename}\"" );
         $mime = MimeTypeTool::GetByFileName( $filename );
         \header( "Content-Type: {$mime}" );
         switch ( $mime )
         {
            case 'image/png':
               \imagepng( $this->r );
               break;
            case 'image/gif':
               \imagegif( $this->r );
               break;
            default:
               \imagejpeg( $this->r, null, $quality );
               break;
         }
         exit;
      }

      \header( "Content-Type: {$this->mimeType}" );

      switch ( $this->mimeType )
      {
         case 'image/png':
            \imagepng( $this->r );
            break;
         case 'image/gif':
            \imagegif( $this->r );
            break;
         default:
            \imagejpeg( $this->r, null, $quality );
            break;
      }

      exit;

   }
public final function output( int $quality = 60, string $filename = null )
   {

      \header( 'Expires: 0' );
      \header( 'Cache-Control: private' );
      \header( 'Pragma: cache' );

      if ( empty( $filename ) )
      {
         $filename = \basename( $this->_file );
      }
      else
      {
         $filename = \basename( $filename );
      }

      if ( ! empty( $filename ) )
      {
         \header( "Content-Disposition: inline; filename=\"{$filename}\"" );
         $mime = MimeTypeTool::GetByFileName( $filename );
         \header( "Content-Type: {$mime}" );
         switch ( $mime )
         {
            case 'image/png':
               \imagepng( $this->r );
               break;
            case 'image/gif':
               \imagegif( $this->r );
               break;
            default:
               \imagejpeg( $this->r, null, $quality );
               break;
         }
         exit;
      }

      \header( "Content-Type: {$this->mimeType}" );

      switch ( $this->mimeType )
      {
         case 'image/png':
            \imagepng( $this->r );
            break;
         case 'image/gif':
            \imagegif( $this->r );
            break;
         default:
            \imagejpeg( $this->r, null, $quality );
            break;
      }

      exit;

   }
public final function output ( int $ quality = 60 , string $ filename = null ) { \ header ( 'Expires: 0' ) ; \ header ( 'Cache-Control: private' ) ; \ header ( 'Pragma: cache' ) ; if ( empty ( $ filename ) ) { $ filename = \ basename ( $ this -> _file ) ; } else { $ filename = \ basename ( $ filename ) ; } if ( ! empty ( $ filename ) ) { \ header ( "Content-Disposition: inline; filename=\"{$filename}\"" ) ; $ mime = MimeTypeTool :: GetByFileName ( $ filename ) ; \ header ( "Content-Type: {$mime}" ) ; switch ( $ mime ) { case 'image/png' : \ imagepng ( $ this -> r ) ; break ; case 'image/gif' : \ imagegif ( $ this -> r ) ; break ; default : \ imagejpeg ( $ this -> r , null , $ quality ) ; break ; } exit ; } \ header ( "Content-Type: {$this->mimeType}" ) ; switch ( $ this -> mimeType ) { case 'image/png' : \ imagepng ( $ this -> r ) ; break ; case 'image/gif' : \ imagegif ( $ this -> r ) ; break ; default : \ imagejpeg ( $ this -> r , null , $ quality ) ; break ; } exit ; }
Outputs the current image, including all required HTTP headers and exit the script.

@param  integer $quality  Image quality if it is an JPEG image. (1-100)
@param  string  $filename Output image file name for HTTP headers.
Outputs the current image including all required HTTP headers and exit the script .