Return the image data as string

@param int		$quality
@param string		$type		jpg|png|gif
@return string
542429
public function stringify( $quality = null, $type = null ) 
	{
		ob_start(); $this->stream( $quality, $type ); return ob_get_clean();
	}
30539
public static function saveImage( $fileName, $resource, $type = IMAGETYPE_PNG, $quality = 100 )
	{
		switch( $type )
		{
			case IMAGETYPE_PNG:
				ImagePNG( $resource, $fileName );
				break;
			case IMAGETYPE_JPEG:
				ImageJPEG( $resource, $fileName, $quality );
				break;
			case IMAGETYPE_GIF:
				ImageGIF( $resource, $fileName );
				break;
			default:
				throw new InvalidArgumentException( 'Invalid Image Type' );
		}
	}
137918
public function getImagesOfType($type)
    {
        // Check to see if type is here.
        if (! in_array($type, $this->getImageTypes())) {
            throw new \Exception('Type not found in model '.self::class);
        }

        return $this->images()->where('image_type', '=', $type)->get();
    }
375959
public function getHash($type = 'guess', $quality = 80, $extras = [])
    {
        if (null === $this->hash) {
            $this->generateHash($type, $quality, $extras);
        }

        return $this->hash;
    }
556125
public function of($type)
    {
        $type = strtolower($type);

        switch ($type) {

            case 'image':
            case 'jpg':
            case 'jpeg': {
                $this->type = 'jpg';
                break;
            }

            case 'audio':
            case 'mp3': {
                $this->type = 'mp3';
                break;
            }

            default: {
                if (in_array($type, ['png', 'pdf', 'doc', 'docx', 'odt'])) {
                    $this->type = $type;
                } else {
                    throw new InvalidArgumentException("Given type [$type] is incorrect.");
                }
            }
        }

        return $this;
    }
1108699
public function display($type = 'jpeg')
    {
        $type = $this->getType($type);

        header('Content-Type: image/' . $type);

        if ($type === 'jpeg')
        {
            imageinterlace($this->newImage, true);
        }

        $imageFunc = 'image' . $type;
        $imageFunc($this->newImage);

        $this->destroyAll();

        return $this;
    }
79614
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;

   }
7634
public function save($imageTargetFilePath, $quality = 100)
    {
        $resampleImageResource =& $this->getResampleImageResource();

        $extension = pathinfo($imageTargetFilePath, PATHINFO_EXTENSION);

        switch ($extension) {
            case 'jpg':
            case 'jpeg':
                return (bool)@imagejpeg($resampleImageResource, $imageTargetFilePath, $quality);
                break;

            case 'gif':
                return (bool)@imagegif($resampleImageResource, $imageTargetFilePath);
                break;

            case 'png':
                imagealphablending($resampleImageResource, false);
                imagesavealpha($resampleImageResource, true);

                return (bool)@imagepng($resampleImageResource, $imageTargetFilePath);
                break;

            case 'webp':
                return (bool)@imagewebp($resampleImageResource, $imageTargetFilePath);
                break;
        }

        return false;
    }
27006
public function save($filename, $image_type = null, $quality = null, $permissions = null)
    {
        $image_type = $image_type ?: $this->source_type;
        if ($this->centered) {
            $dest_image = imagecreatetruecolor($this->ask_w, $this->ask_h);
        } else {
            $dest_image = imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight());
        }
        imageinterlace($dest_image, $this->interlace);
        switch ($image_type) {
            case IMAGETYPE_GIF:
                $background = imagecolorallocatealpha($dest_image, 255, 255, 255, 1);
                imagecolortransparent($dest_image, $background);
                imagefill($dest_image, 0, 0, $background);
                imagesavealpha($dest_image, true);
                break;
            case IMAGETYPE_JPEG:
                $background = imagecolorallocate($dest_image, 255, 255, 255);
                if ($this->centered) {
                    imagefilledrectangle($dest_image, 0, 0, $this->ask_w, $this->ask_h, $background);
                } else {
                    imagefilledrectangle($dest_image, 0, 0, $this->getDestWidth(), $this->getDestHeight(), $background);
                }
                break;
            case IMAGETYPE_PNG:
                imagealphablending($dest_image, false);
                $background = imagecolorallocate($dest_image, 255, 255, 255);
                if ($this->centered) {
                    imagefilledrectangle($dest_image, 0, 0, $this->ask_w, $this->ask_h, $background);
                } else {
                    imagefilledrectangle($dest_image, 0, 0, $this->getDestWidth(), $this->getDestHeight(), $background);
                }
                    imagesavealpha($dest_image, true);
                break;
        }
        imagecopyresampled(
            $dest_image,
            $this->source_image,
            $this->dest_x,
            $this->dest_y,
            $this->source_x,
            $this->source_y,
            $this->getDestWidth(),
            $this->getDestHeight(),
            $this->source_w,
            $this->source_h
        );
        switch ($image_type) {
            case IMAGETYPE_GIF:
                imagegif($dest_image, $filename);
                break;
            case IMAGETYPE_JPEG:
                if ($quality === null) {
                    $quality = $this->quality_jpg;
                }
                imagejpeg($dest_image, $filename, $quality);
                break;
            case IMAGETYPE_PNG:
                if ($quality === null) {
                    $quality = $this->quality_png;
                }
                imagepng($dest_image, $filename, $quality);
                break;
        }
        if ($permissions) {
            chmod($filename, $permissions);
        }
        return $this;
    }
698085
public function encode($format, $quality = null)
    {
        $this->toggleModified();

        $this->getInterventionImage()->encode($format, $quality);

        return $this;
    }
1137642
public function getDominantColor($image, $quality = 10, $colorValue = 'hex')
    {
        return Plugin::$plugin->color->getDominantColor($image, $quality, $colorValue);
    }
487642
public static function output($image, $type)
    {
        $parts = explode('/', $type);
        $func = 'image'.strtolower($parts[1]);
        if (!function_exists($func)) {
            return;
        }

        $args = null;

        switch ($parts[1]) {
            case 'jpeg':
                $args = array($image, null, 100);
                break;
            case 'png':
                $args = array($image, null, 9);
                break;
            case 'gif':
                $args = array($image, null);
                break;
            default:
                return;
        }
        ob_start();
        call_user_func_array($func, $args);
        $image = ob_get_clean();

        return $image;
    }
1148390
public function display( $sendContentType = TRUE )
	{
		if( $sendContentType )
			header( 'Content-type: '.$this->getMimeType() );
		switch( $this->getType() )
		{
			case IMAGETYPE_GIF:
				imagegif( $this->resource );
				break;
			case IMAGETYPE_JPEG:
				imagejpeg( $this->resource, NULL, $this->quality );
				break;
			case IMAGETYPE_PNG:
				imagepng( $this->resource );
				break;
			default:
				header_remove( 'Content-type' );
				new UI_Image_Error( 'invalid type' );
		}
	}
1155210
public function save($imgname, $type = null, $quality=80,$interlace = true){
        $this->img->save($imgname, $type, $quality,$interlace);
        return $this;
    }
586518
public function quality($quality = null)
    {
        if ($quality) {
            if (!$this->image) {
                $this->image();
            }

            $this->quality = $quality;

            return $this;
        }

        return $this->quality;
    }
242335
public function getImage($type, $size, array $attributes = array())
	{
		if (empty($this->$type))
		{
			return null;
		}
		$html = '<img src="' . $this->getImageSrc($type, $size) . '"';
		$html .= ' alt="' . $this->{$type.'_alt'} . '"';
		$html .= ' width="' . $this->getImageWidth($type, $size) . '"';
		$html .= ' height="' . $this->getImageHeight($type, $size) . '"';
		
		$html_attributes = '';
		if (!empty($attributes)) {
			$html_attributes = join(' ', array_map(function($key) use ($attributes) {
				if(is_bool($attributes[$key]))
				{
					return $attributes[$key] ? $key : '';
				}
				return "{$key}=\"{$attributes[$key]}\"";
			}, array_keys($attributes)));
		}
		
		return $html;
	}
1271361
public function Quality($quality)
    {
        // Generate variant key
        $variant = $this->owner->variantName(__FUNCTION__, $quality);

        // Instruct the backend to search for an existing variant and use the callback to provide it if it does not exist.
        return $this->owner->manipulateImage($variant, function (Image_Backend $backend) use ($quality) {
            $backendClone = clone $backend;
            $backendClone->setQuality($quality);

            return $backendClone;
        });
    }