public function writeToStore(AssetStore $assetStore, $filename, $hash = null, $variant = null, $config = array())
    {
        try {
            $resource = $this->getImageResource();
            if (!$resource) {
                throw new BadMethodCallException("Cannot write corrupt file to store");
            }

            // Save file
            $extension = pathinfo($filename, PATHINFO_EXTENSION);
            $result = $assetStore->setFromString(
                $resource->encode($extension, $this->getQuality())->getEncoded(),
                $filename,
                $hash,
                $variant,
                $config
            );

            // Warm cache for the result
            if ($result) {
                $this->warmCache($result['Hash'], $result['Variant']);
            }

            return $result;
        } catch (NotSupportedException $e) {
            return null;
        }
    }
public function writeToStore(AssetStore $assetStore, $filename, $hash = null, $variant = null, $config = array())
    {
        try {
            $resource = $this->getImageResource();
            if (!$resource) {
                throw new BadMethodCallException("Cannot write corrupt file to store");
            }

            // Save file
            $extension = pathinfo($filename, PATHINFO_EXTENSION);
            $result = $assetStore->setFromString(
                $resource->encode($extension, $this->getQuality())->getEncoded(),
                $filename,
                $hash,
                $variant,
                $config
            );

            // Warm cache for the result
            if ($result) {
                $this->warmCache($result['Hash'], $result['Variant']);
            }

            return $result;
        } catch (NotSupportedException $e) {
            return null;
        }
    }
public function writeToStore ( AssetStore $ assetStore , $ filename , $ hash = null , $ variant = null , $ config = array ( ) ) { try { $ resource = $ this -> getImageResource ( ) ; if ( ! $ resource ) { throw new BadMethodCallException ( "Cannot write corrupt file to store" ) ; } // Save file $ extension = pathinfo ( $ filename , PATHINFO_EXTENSION ) ; $ result = $ assetStore -> setFromString ( $ resource -> encode ( $ extension , $ this -> getQuality ( ) ) -> getEncoded ( ) , $ filename , $ hash , $ variant , $ config ) ; // Warm cache for the result if ( $ result ) { $ this -> warmCache ( $ result [ 'Hash' ] , $ result [ 'Variant' ] ) ; } return $ result ; } catch ( NotSupportedException $ e ) { return null ; } }
Write to the given asset store

@param AssetStore $assetStore
@param string $filename Name for the resulting file
@param string $hash Hash of original file, if storing a variant.
@param string $variant Name of variant, if storing a variant.
@param array $config Write options. {@see AssetStore}
@return array Tuple associative array (Filename, Hash, Variant) Unless storing a variant, the hash
will be calculated from the given data.
@throws BadMethodCallException If image isn't valid
Write to the given asset store