tabennett/Laravel3-Stapler

Checking if an attachment exists

Closed this issue · 2 comments

Hey, is there an easy way to check for the presence of an attachment? Of course xx_url and xx_path return the path to the missing.png if the attachment doesn't exist, but since this can be changed, it's not a reliable check.

Ended up adding an extra case to __call in stapler.php on line 369. Now xx_exists() returns true or false if the original file exists :-)

case 'exists':
    $resource = $this->path($pieces[0], 'original');
    return file_exists($resource);
    break;

Or you could just set default_url to an empty string, if you're not using it.