classes/Models/Element.php
protected function getReplacementImage(Image $image)
    {
        // Check that the image is in the elements dir, which means it's
        // a default image
        if (!strpos($image->file, '/elements/')) {
            return;
        }

        // Get the current file value form the YAML.  Need to check for the
        // shorthand with the type suffix as well.
        $yaml = app('decoy.elements')->assocConfig();
        $replacement = $yaml[$this->key]['value'];

        // Check if the filenames are the same
        if (pathinfo($image->file, PATHINFO_BASENAME)
            == pathinfo($replacement, PATHINFO_BASENAME)) {
            return;
        }

        // Since the filenames are not the same, remove the old image and generate
        // a new one
        $image->delete();
        $this->exists = true; // It actually does exist if there was an Image
        $this->value = $replacement;

        return $this->defaultImage();
    }
protected function getReplacementImage(Image $image)
    {
        // Check that the image is in the elements dir, which means it's
        // a default image
        if (!strpos($image->file, '/elements/')) {
            return;
        }

        // Get the current file value form the YAML.  Need to check for the
        // shorthand with the type suffix as well.
        $yaml = app('decoy.elements')->assocConfig();
        $replacement = $yaml[$this->key]['value'];

        // Check if the filenames are the same
        if (pathinfo($image->file, PATHINFO_BASENAME)
            == pathinfo($replacement, PATHINFO_BASENAME)) {
            return;
        }

        // Since the filenames are not the same, remove the old image and generate
        // a new one
        $image->delete();
        $this->exists = true; // It actually does exist if there was an Image
        $this->value = $replacement;

        return $this->defaultImage();
    }
protected function getReplacementImage ( Image $ image ) { // Check that the image is in the elements dir, which means it's // a default image if ( ! strpos ( $ image -> file , '/elements/' ) ) { return ; } // Get the current file value form the YAML.  Need to check for the // shorthand with the type suffix as well. $ yaml = app ( 'decoy.elements' ) -> assocConfig ( ) ; $ replacement = $ yaml [ $ this -> key ] [ 'value' ] ; // Check if the filenames are the same if ( pathinfo ( $ image -> file , PATHINFO_BASENAME ) == pathinfo ( $ replacement , PATHINFO_BASENAME ) ) { return ; } // Since the filenames are not the same, remove the old image and generate // a new one $ image -> delete ( ) ; $ this -> exists = true ; // It actually does exist if there was an Image $ this -> value = $ replacement ; return $ this -> defaultImage ( ) ; }
Check if the Image represents a default image but is out of date

@param  Image      $image
@return Image|void
Check if the Image represents a default image but is out of date