public function load($mime, $blob) {
        if (!isset($this->loaders[$mime])) {
            return null;
        }

        foreach ($this->loaders[$mime] as $loader) {
            $result = $loader->load($this->imagick, $blob, $mime);

            // If the result is false, let the loop continue to try more loaders, if they exist. If
            // the result is anything else, return the imagick instance as this means that the
            // loader managed to load the image
            if ($result !== false) {
                // Convert images that are CMYK without an explicit profile to SRGB
                $iccProfiles = $this->imagick->getImageProfiles('icc', false);

                if (!$iccProfiles && ($this->imagick->getImageColorspace() === Imagick::COLORSPACE_CMYK)) {
                    $iccCMYK = file_get_contents(__DIR__ . '/../../data/profiles/argyllcms_cmyk.icm');
                    $this->imagick->profileImage('icc', $iccCMYK);

                    $iccSRGB = file_get_contents(__DIR__ . '/../../data/profiles/sRGB_v4_ICC_preference.icc');
                    $this->imagick->profileImage('icc', $iccSRGB);

                    $this->imagick->setImageColorSpace(Imagick::COLORSPACE_SRGB);
                }

                return $this->imagick;
            }
        }

        return false;
    }
public function load($mime, $blob) {
        if (!isset($this->loaders[$mime])) {
            return null;
        }

        foreach ($this->loaders[$mime] as $loader) {
            $result = $loader->load($this->imagick, $blob, $mime);

            // If the result is false, let the loop continue to try more loaders, if they exist. If
            // the result is anything else, return the imagick instance as this means that the
            // loader managed to load the image
            if ($result !== false) {
                // Convert images that are CMYK without an explicit profile to SRGB
                $iccProfiles = $this->imagick->getImageProfiles('icc', false);

                if (!$iccProfiles && ($this->imagick->getImageColorspace() === Imagick::COLORSPACE_CMYK)) {
                    $iccCMYK = file_get_contents(__DIR__ . '/../../data/profiles/argyllcms_cmyk.icm');
                    $this->imagick->profileImage('icc', $iccCMYK);

                    $iccSRGB = file_get_contents(__DIR__ . '/../../data/profiles/sRGB_v4_ICC_preference.icc');
                    $this->imagick->profileImage('icc', $iccSRGB);

                    $this->imagick->setImageColorSpace(Imagick::COLORSPACE_SRGB);
                }

                return $this->imagick;
            }
        }

        return false;
    }
public function load ( $ mime , $ blob ) { if ( ! isset ( $ this -> loaders [ $ mime ] ) ) { return null ; } foreach ( $ this -> loaders [ $ mime ] as $ loader ) { $ result = $ loader -> load ( $ this -> imagick , $ blob , $ mime ) ; // If the result is false, let the loop continue to try more loaders, if they exist. If // the result is anything else, return the imagick instance as this means that the // loader managed to load the image if ( $ result !== false ) { // Convert images that are CMYK without an explicit profile to SRGB $ iccProfiles = $ this -> imagick -> getImageProfiles ( 'icc' , false ) ; if ( ! $ iccProfiles && ( $ this -> imagick -> getImageColorspace ( ) === Imagick :: COLORSPACE_CMYK ) ) { $ iccCMYK = file_get_contents ( __DIR__ . '/../../data/profiles/argyllcms_cmyk.icm' ) ; $ this -> imagick -> profileImage ( 'icc' , $ iccCMYK ) ; $ iccSRGB = file_get_contents ( __DIR__ . '/../../data/profiles/sRGB_v4_ICC_preference.icc' ) ; $ this -> imagick -> profileImage ( 'icc' , $ iccSRGB ) ; $ this -> imagick -> setImageColorSpace ( Imagick :: COLORSPACE_SRGB ) ; } return $ this -> imagick ; } } return false ; }
Load a binary blob as an image.

@param string $mime Mime type of the binary blob
@param string $blob Binary data to load / rasterize
@return boolean|null|Imagick Returns false if all the registered loaders was unable to load
the blob. If any of the loaders ends up with a result other than
false, the imagick instance will be returned.
Load a binary blob as an image .