src/Modifiers/ImageModifier.php
public function replace($res)
    {

        // Check if the image we should replace with is resource
        if (!is_resource($res)) {
            throw new UnexpectedValueException('Invalid resource');
        }

        // Check if we can destroy the image
        if (is_resource($this->image)) {
            imagedestroy($this->image);
        }

        // Set the new image as image
        $this->image = $res;

        // Return $this for chaining
        return $this;
    }
public function replace($res)
    {

        // Check if the image we should replace with is resource
        if (!is_resource($res)) {
            throw new UnexpectedValueException('Invalid resource');
        }

        // Check if we can destroy the image
        if (is_resource($this->image)) {
            imagedestroy($this->image);
        }

        // Set the new image as image
        $this->image = $res;

        // Return $this for chaining
        return $this;
    }
public function replace ( $ res ) { // Check if the image we should replace with is resource if ( ! is_resource ( $ res ) ) { throw new UnexpectedValueException ( 'Invalid resource' ) ; } // Check if we can destroy the image if ( is_resource ( $ this -> image ) ) { imagedestroy ( $ this -> image ) ; } // Set the new image as image $ this -> image = $ res ; // Return $this for chaining return $ this ; }
Replaces the image with the new image

@return $this
Replaces the image with the new image